简体   繁体   中英

url rewrite issue by .htaccess

I have issue on url rewrite i am want to change url

http://www.example.com/mbl.php?domain=example.com to http://www.example.com/mbl/example.com

So i have written code myself by as below

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^/mbl/([^/]+)$ /mbl.php?domain=$1

But its not working. so please to my error.

Thanks

You should try your rules this way and remove the leading slash from the rewriterule with mbl since you are using it in .htaccess file.

Give these rules a try.

#Options -MultiViews
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteRule ^mbl/([^/]+)$ /mbl.php?domain=$1 [L]

RewriteRule ^([^\.]+)$ $1.php [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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM