【发布时间】:2014-02-01 22:44:35
【问题描述】:
我正在尝试重写我网站上的链接。
重写前可能的链接以及重写后我想看到的链接:/index.pl?mode=users&action=add - /users/add//index.pl?mode=streets&action=edit&id=7 - /streets/edit/7/index.pl?mode=users&action=info&id=7 - /users/info/7
等等
.htaccess 内容:
RewriteEngine On
RewriteCond %{REQUEST_URI} !\.(jpe?g|gif|bmp|png|tiff|css|js)$ [NC]
RewriteRule ^([A-Za-z0-9-]+)/((edit|delete|info))/([0-9]+)$ index.pl?mode=$1&action=$2&id=$3 [L]
RewriteRule ^([A-Za-z0-9-]+)/((add))/?$ index.pl?mode=$1&action=$2 [L]
RewriteRule ^([A-Za-z0-9-]+)/?$ index.pl?mode=$1 [L]
/users/add/ 或 /street/add/ 工作正常,但是...
问题:/users/edit/xx - 我不能在 perl 脚本中接受 ID。为什么? /users/info/xx - 我什至无法进入信息部分 /?mode=users&action=info&id=7 页面(它必须显示 ID 错误的空白表
顺便说一句...我的网站有“开关”结构。我的意思是如果模式是用户,那么它会加载“users.pl”,如果模式=streets 加载“streets.pl”等。关于第二个问题 - 确定我在 users.pl 有信息部分!并链接/?mode=users&action=info&id=7 完美运行。
p.s.: 添加 php-tag 因为它不是 'perl' 问题,但是 php 等于 perl,所以 php-followers 也可以帮助我
p.p.s.:对不起,我的英语不太好。
【问题讨论】:
标签: php perl apache .htaccess mod-rewrite