I have the following .htaccess file which helps me to rewrite the http://domain/profile.php?uid=1 as http://domain/1
RewriteEngine on
#this removes .php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php !-f
RewriteRule ^(.+)$ /profile?uid=$1 [QSA,NC,L]
But when i add slash on the url, it gives me errors also how can i add another parameter for example:
http://domain/profile.php?uid=1§ion=about
to
You can use this
RewriteEngine on
#remove .php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^\.]+)/?$ /$1.php [NC,L]
#rewrite /1/about
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/(.+)/?$ /profile?uid=$1§ion=$2 [QSA,NC,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.