Apache mod重写url htaccess
我有点困惑,仍然在学习如何在ApacheHTAccess中重写 我怎样才能扭转这种局面: 为此: 这是我的参考资料,我不确定我做得是否正确Apache mod重写url htaccess,apache,url,rewrite,Apache,Url,Rewrite,我有点困惑,仍然在学习如何在ApacheHTAccess中重写 我怎样才能扭转这种局面: 为此: 这是我的参考资料,我不确定我做得是否正确 <a href='http://www.mydomain.com/dir1/post.php? id=$id'> 如果只需要重写单个URL,则可以使用简单的重写规则 RewriteRule ^dir1/post.php?%20id=1 category1/post/1 [L] 或者您可能需要将%20替换为空白字符regex Rewrite
<a href='http://www.mydomain.com/dir1/post.php? id=$id'>
如果只需要重写单个URL,则可以使用简单的重写规则
RewriteRule ^dir1/post.php?%20id=1 category1/post/1 [L]
或者您可能需要将%20替换为空白字符regex
RewriteRule ^dir1/post.php?[\s]id=1 category1/post/1 [L]
您需要确保mod_rewrite也处于打开状态(.htaccess中的“RewriteEngine on”)
这里有一个很好的提示:非常感谢您的帮助,先生,我会试试您给我的建议。。。对不起,英语不好。。。我感谢你的帮助。。godblesshi在那里..又是我我想问一下file.htaccess[在我的例子中它位于/public\u html]的位置是否与它的效果有关?我所做的是。。RewriteRule ^dir1/post.php上的RewriteEngine?%20id=1 category1/post/1[L]尝试将%20替换为[\s]。这是空白字符的正则表达式。如果这不起作用,试试这些建议。