RewriteRule不适用于XAMPP apache中的某些链接

时间:2017-04-08 20:05:36

标签: apache .htaccess mod-rewrite xampp

RewriteEngine On   
RewriteRule ^home/?$ pages/forum_html.php [NC,L] 
RewriteRule ^forum-thread/([A-Za-z0-9]+)/?$ pages/forum_thread_gen_html.php?thread_id=$1 [NC,L]  

我正在尝试进行内部网址重定向。第一个RewriteRule工作正常,但第二个不起作用,页面显示找不到对象,但是当我将第二行更改为^forum-thread/?$页面显示但当然没有我的页面要处理的ID。

有没有人知道可能会发生什么?

第二个网址如下所示:

localhost/rootfolder/projectfolder/forum-thread/cdjd2_dsdsd4_adsda/

1 个答案:

答案 0 :(得分:0)

URL有下划线,我使用的模式匹配序列中没有下划线。我已经编辑了第二个RewriteRule: RewriteRule ^forum-thread/([A-Za-z0-9-_]+)/?$ pages/forum_thread_gen_html.php?thread_id=$1 [NC,L]

相关问题