.htaccess HTACCESS将/admin重定向到admin.php
我的nice URL运行良好,并指向index.php页面,但我想添加一个例外。如果用户在/admin中键入他们得到的是admin.php而不是index.php,我希望这样做 我有这个:.htaccess HTACCESS将/admin重定向到admin.php,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,我的nice URL运行良好,并指向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_FI
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
但这似乎不起作用
谢谢!
Scott重写规则^admin$admin.php[L,NC]怎么样?谢谢您的回答!我想避免重写规则,因为管理区域使用相对路径,所以我更喜欢执行完全重定向,以不中断任何指向图像等的链接。我只希望它们有一个更容易记住的链接,但不需要看起来像前端,但^admin$完全是admin而不是其他意思,不是从管理员或其他什么开始的。至于相对路径问题,标签会有帮助吗?