简体   繁体   English

.htaccess的网址重写问题

[英]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 http://www.example.com/mbl.php?domain=example.comhttp://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. 您应该以这种方式尝试使用规则,并使用mbl从重写器中删除前导斜线,因为您在.htaccess文件中使用了它。

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]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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