1

我的同事提议在我们的系统上实施 .htaccess 重写规则。我什至不确定这是否可能,我希望在这个主题上比我受过更多教育的人来验证。

这是目前的网址:

http://cms.phasesolutions.ca/themes/Default/page.php?slug=home

这是他希望它显示的方式:

http://cms.phasesolutions.ca/pages/home/

那可能吗?(“?slug =”的变量和“默认”文件夹可能会发生变化,具体取决于他们正在访问的主题以及他们指定的slug)

告诉我,谢谢

4

1 回答 1

1

如果您需要起点,请发布解决方案。

通过启用 mod_rewrite 和 .htaccess httpd.conf,然后将此代码放在您.htaccessDOCUMENT_ROOT目录下:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On

# handles /Default/home/ to /themes/Default/page.php?slug=home
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$2.php -f
RewriteRule ^([^/]+)/([^/]+)/?$ /themes/$1/$2.php?slug=home [L,QSA]
于 2013-07-18T06:32:40.637 回答