在哪里添加htaccess重写的时间段

时间:2013-04-17 20:31:41

标签: .htaccess url-rewriting

我的htaccess中有以下内容:

RewriteRule ^([a-zA-Z0-9\s_-]+)$ profile.php?uid=$1

问题是一段时间会破坏页面,例如:www.mydomain.com/john.smith

我如何允许这段时间?

由于

1 个答案:

答案 0 :(得分:1)

根据您的情况/上下文,您可以检查和排除profile.php的请求,或检查请求是否针对现有文件或目录:

RewriteCond %{REQUEST_URI} !/profile\.php
RewriteRule ^([a-zA-Z0-9\s_.-]+)$ profile.php?uid=$1

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9\s_.-]+)$ profile.php?uid=$1