Friendly URL on specific page

-2

I have a client project in production (locaweb then n has cpanel: |) and I have a news page and I need to leave it with a friendly URL, page noticia.php has the following code: How do I leave a page and need to leave it with a friendly URL. The page noticia.php , and has the following code:

$urlpath    = $_SERVER['PATH_INFO'];
$urlpath    = $_SERVER['PATH_INFO'];
$paths        = explode('-', $urlpath);
$paths        = explode('-', $urlpath);
$i_item        = end($paths);
$i_item        = end($paths);

It takes the '/ titulo-da-noticia-00', 00 that would be the ID of the news, I need the URL ' link 'can also be accessed by' link '

The .htaccess current is like this:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

But when I access the hosting I get the following error message:

  

HTTP Error 404.0 - Not Found The resource you are looking for has been   removed, had its name changed, or is temporarily unavailable.

    
asked by anonymous 04.09.2018 / 19:15

1 answer

0

Try this

News.php file

<?php
    $titulo = $_GET['noticia'];
    $id = end(explode('-',$titulo));
    echo $id;
?>

.htaccess file

RewriteEngine On
RewriteRule ^noticia\/(.*)$ noticia.php?noticia=$1

Url

/ news / title-of-news-222

    
04.09.2018 / 19:38