Htaccess - Friendly URL in the root of the site

0

How to make friendly URL open in root.

I have the file WorkView.php? id = 1 would like it to open like this:

  

www.site.com/87190-first-test

Does not work:

RewriteRule ^([^/]*)\$ /trabalhoVer.php?id=$1 [NC,L]
    
asked by anonymous 09.08.2017 / 15:17

1 answer

1

Try this way, please see if it is resolved:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ trabalhoVer.php?id=$1 [QSA,L]
</IfModule>

As requested in the comment, I tested on port 8080 like this:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond  %{SERVER_PORT} !^8080$
    RewriteRule ^(.*) http://%{SERVER_NAME}:8080%{REQUEST_URI}  

    RewriteCond  %{SERVER_PORT} ^8080$ 
    RewriteRule ^(.*)$ trabalhoVer.php?id=$1 [QSA,L]
</IfModule>

Here it worked. See:

    
09.08.2017 / 16:34