mod重写规则以包括句点 [英] mod rewrite rule to include period
本文介绍了mod重写规则以包括句点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我应该添加重写规则以包括阅读期吗?
What should I add the rewrite rule to include reading periods?
我目前在我的.htaccess文件中有此文件:
I have this currently on my .htaccess:
RewriteEngine on
RewriteRule ^([a-zA-Z0-9_-]+)$ /user/public/index.php?username=$1 [L]
如果我有它,它可以正常工作:
if i have this it works fine:
但是如果我有这个,我会得到404:
but if i have this i get the 404:
谢谢.
推荐答案
将点添加到允许的输入集中.
Add the point to your set of allowed input.
尝试一下...
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([a-zA-Z0-9\._-]+)$ /user/public/index.php?username=$1 [L]
</IfModule>
我不知道您页面的URL结构,但是更好的重写方法是...
I don't know the URL structure of your page, but a better way of rewriting would be...
RewriteRule ^user/public/([a-zA-Z0-9\._-]+)$ /user/public/index.php?username=$1 [L]
这篇关于mod重写规则以包括句点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文