主目录中的Apache mod_rewrite文件位于伪目录中

时间:2015-08-25 18:55:51

标签: apache .htaccess mod-rewrite

我将所有网站文件都放在一个目录中,并尝试创建嵌套链接外观。我只获取了第一条规则并应用它的代码,但我想指定每个URL重定向到的位置。现在这两个规则都提到了how-we-invest.php。

Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?how-it-works(/.*)?$ how-we-invest.php [L,NC]
RewriteRule ^/?how-it-works(/.*)?$ pricing.php [L,NC]

在我的脑海中,似乎我应该可以做这样的事情,但它不起作用:

RewriteRule ^/?how-it-works/how-we-invest/?$ how-we-invest.php [L,NC]

因此,理想情况下,当您访问website.com/how-it-works/how-we-invest/时,它会引入位于根目录中的how-we-invest.php。

感谢您的帮助。

0 个答案:

没有答案