【发布时间】:2015-03-15 15:08:44
【问题描述】:
我尝试为我的网站制作漂亮的网址,例如: http://code.tutsplus.com/tutorials/using-htaccess-files-for-pretty-urls--net-6049
我的 .htaccess 文件如下所示:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^profile/(\d+)*$ ./profile.php?id=$1
它可以工作,root/profile/123 打开 root/profile.php?id=123,但文件夹路径现在已损坏:
root/profile.php?id=123 引用例如 root/css/style.css
但是 root/profile/123 想要引用 root/profile/css/style.css,它不存在。
我想让它同时工作:root/profile.php?id=123 和 root/profile/123
如何解决链接问题?
【问题讨论】:
标签: php apache .htaccess mod-rewrite