What I want to achieve is build urls like /profile1 /profile2 ...etc. which rewrites to profile.php?id=profile1
The code I am using currently is
RewriteRule ^(.+)$ profile.php?p=$1 [NC,QSA,L]
It works as expected but problem is It also rewrites for urls like /sp.php?e=mybids
Those Urls are also redirected to profile.php, which I don't want it to happen.
Any help?
RewriteRule ^([^\.]+)$ profile.php?p=$1 [NC,QSA,L]
You can check if the file does not exist, then redirect to profile.php:
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule ^(.*)$ /profile.php?p=$1 [R=301,L]
Good luck
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.