Php 输入链接时重定向用户

Php 输入链接时重定向用户,php,regex,apache,.htaccess,mod-rewrite,Php,Regex,Apache,.htaccess,Mod Rewrite,我知道还有其他帖子也在问同样的问题,但我似乎无法让它们发挥作用 当用户键入 http://mywebsite.com/msdns/[letters, numbers, and symbols here] 我需要它进入我的页面: http://mywebsite.com/msdns/index.php?q=[letters, numbers, and symbols here] 到目前为止,我的.htaccess文件(与index.php位于同一文件夹中)中有以下内容: 然而,这是行不通的。有

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

当用户键入

http://mywebsite.com/msdns/[letters, numbers, and symbols here]
我需要它进入我的页面:

http://mywebsite.com/msdns/index.php?q=[letters, numbers, and symbols here]
到目前为止,我的.htaccess文件(与index.php位于同一文件夹中)中有以下内容:

然而,这是行不通的。有什么解决办法吗


提前感谢您,pat将此规则放入您的
/msdns/.htaccess

RewriteEngine On
RewriteBase /msdns/

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

我就是这么做了,当你回答时,我不得不等15分钟;)
RewriteEngine On
RewriteBase /msdns/

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