0
How to make URL friendly open at the root.
I have the file workVer.php? id=1 I’d like it to open like this:
www.site.com/87190-first-test
Doesn’t work:
RewriteRule ^([^/]*)\$ /trabalhoVer.php?id=$1 [NC,L]
0
How to make URL friendly open at the root.
I have the file workVer.php? id=1 I’d like it to open like this:
www.site.com/87190-first-test
Doesn’t work:
RewriteRule ^([^/]*)\$ /trabalhoVer.php?id=$1 [NC,L]
1
Try this way, please see if it resolves:
<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 did the test on door 8080 so:
<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. Look:
I am using localhost on port 8080. How do I keep the test port, and then when I go up to the server remove? When I load the page this removing the port.
Try as follows: <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 ^(.)$ workVer.php? id=$1 [QSA,L] </Ifmodule>
Browser other questions tagged php htaccess
You are not signed in. Login or sign up in order to post.
What should be the value of
id? Why doesn’t it work? What is the error generated?– Woss
Valor
87190-primeiro-teste– Tiago