.htaccess文件不能正常工作的服务器 [英] .htaccess file is not working on server
本文介绍了.htaccess文件不能正常工作的服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个这样的网址
www.subdomain.mydomain.com/mydir/admin/index.php?page=dashboard
我想有一个用户友好的URL像这样
I want to have a user friendly url like this
www.subdomain.mydomain.com/mydir/admin/dashboard
我如何做到这一点?我想有以下提到的code。我在做什么错在这里?
How do I achieve this? I am trying with the below mentioned code. What am I doing wrong here?
Options -MultiViews
# URL rewriting module activation
RewriteEngine on
RewriteCond %{REQUEST_METHOD} !^(TRACE|TRACK|GET|POST|HEAD)$
RewriteRule .* - [F]
RewriteBase /
Options +FollowSymLinks
RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?page=$1 [L]
有关类似的情况下,请参阅<一href="http://stackoverflow.com/questions/11151357/htaccess-file-is-not-working-on-go-daddy-server/27834681#27834681">this问题。
For a similar context please refer this question.
推荐答案
试试这个的.htaccess:
Try this .htaccess:
Options +FollowSymLinks -MultiViews
RewriteEngine on
# use appropriate rewrite base
RewriteBase /mydir/admin/
RewriteCond %{REQUEST_METHOD} !^(TRACE|TRACK|GET|POST|HEAD)$
RewriteRule ^ - [F]
RewriteCond %{THE_REQUEST} /index\.php\?page=([\w-]+) [NC]
RewriteRule ^ %1? [L,R]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)/?$ index.php?page=$1 [L,QSA]
这篇关于.htaccess文件不能正常工作的服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文