HTACCESS 将 /admin 重定向到 admin.php

发布于 2025-01-07 06:10:16 字数 526 浏览 1 评论 0原文

我的漂亮网址工作正常,并且正在前往我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

樱&纷飞 2025-01-14 06:10:16

RewriteRule ^admin$ admin.php [L, NC] 怎么样?

How about RewriteRule ^admin$ admin.php [L, NC]?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文