Currently i have a url like this.
http://domain.com/main.php?page=Welcome.php
I'm looking to use the rewrite tool within htaccess
to get rid of the main.php?page=
so it will just become http://domain.com/Welcome.php
Or even better get rid of the .php
to http://domain.com/Welcome
I have been trying to use the rewrite and using;
RewriteRule ^(.*)$ main.php?Page=$1 [QSA,L]
But its not working :(
Try this rule in your site root .htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)/?$ main.php?Page=$1.php [QSA,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.