.htaccess 文件在服务器上不工作
.htaccess file is not working on server
我有一个URL这样的
www.subdomain.mydomain.com/mydir/admin/index.php?page=dashboard
我想要一个像这样的用户友好 url
www.subdomain.mydomain.com/mydir/admin/dashboard
我该如何实现?我正在尝试使用下面提到的代码。我在这里做错了什么?
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= [L]
对于类似的上下文,请参阅 this question。
试试这个 .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= [L,QSA]
我有一个URL这样的
www.subdomain.mydomain.com/mydir/admin/index.php?page=dashboard
我想要一个像这样的用户友好 url
www.subdomain.mydomain.com/mydir/admin/dashboard
我该如何实现?我正在尝试使用下面提到的代码。我在这里做错了什么?
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= [L]
对于类似的上下文,请参阅 this question。
试试这个 .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= [L,QSA]