【问题标题】:Redirect users when entering a link输入链接时重定向用户
【发布时间】:2014-02-26 23:18:57
【问题描述】:

我知道还有其他帖子在问同样的问题,但我似乎无法让它们发挥作用。

当用户键入时

http://mywebsite.com/msdns/[letters, numbers, and symbols here]

我需要它来访问我的页面:

http://mywebsite.com/msdns/index.php?q=[letters, numbers, and symbols here]

到目前为止,我的 .htaccess 文件中有这个(与 index.php 位于同一文件夹中):

RewriteEngine On
RewriteRule ^/(.*)/$ /index.php?q=$1

但这不起作用。有什么解决办法吗?

提前谢谢你,拍拍

【问题讨论】:

    标签: php regex apache .htaccess mod-rewrite


    【解决方案1】:

    将此规则放入您的/msdns/.htaccess

    RewriteEngine On
    RewriteBase /msdns/
    
    RewriteRule ^((?!index\.php).+)$ index.php?q=$1 [L,QSA]
    

    【讨论】:

    • 我刚做了,当你回答时,我不得不等 15 分钟 ;)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-03
    • 2023-03-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多