Here i'm facing problem with rewriting url. I'm using php(ver. above 5.0) with xampp.
My current url is
Original url : /localhost/test/signup.php
redirect Url : /localhost/test/signup/
I wrote rewrite rules in htdocs
RewriteEngine On
RewriteBase /test/
RewriteRule ^signup/$ signup.php
it's not working. I was changed httpd.conf setting also. but no use.
use below working code for me to hide .php extension.
RewriteEngine On
# Unless directory, remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ http://example.com/folder/$1 [R=301,L]
# Redirect external .php requests to extensionless url
RewriteCond %{THE_REQUEST} ^(.+)\.php([#?][^\ ]*)?\ HTTP/
RewriteRule ^(.+)\.php$ http://example.com/folder/$1 [R=301,L]
# Resolve .php file for extensionless php urls
RewriteRule ^([^/.]+)$ $1.php [L]
What error you are getting?
Meanwhile you may try with this
RewriteEngine On
RewriteBase /test/
RewriteRule ^(signup)$ signup.php [L]
for all php files:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) $1.php [L]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.