HTACCESS 将 /admin 重定向到 admin.php
我的漂亮网址工作正常,并且正在前往我的 index.php
页面,但我想添加一个例外。我希望用户输入 /admin 时会得到 admin.php
而不是 index.php
。
我有这个:
RewriteEngine on
RewriteBase /
# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1
我尝试将其添加到文件的开头:
Redirect /admin admin.php
但这似乎不起作用
谢谢! 斯科特
I have my nice urls working fine and heading to my index.php
page, but I want to add one exception. I would like it if the user types in /admin that they get admin.php
rather than index.php
.
I have this:
RewriteEngine on
RewriteBase /
# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1
I tried adding this to the beginning of the file:
Redirect /admin admin.php
but that doesn't seem to do the trick
Thanks!
Scott
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
RewriteRule ^admin$ admin.php [L, NC]
怎么样?How about
RewriteRule ^admin$ admin.php [L, NC]
?