有人可以帮我优化和修复我的.htaccess文件吗?我在正则表达式上非常糟糕,而且我不是服务器用户,因为错误,我正在构建的网站无法访问。非常感谢任何帮助。
SetEnv _SRVR_ENV beta
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
## Paypal Callback Rules
RewriteCond %{QUERY_STRING} token=(\w+-\w+)&PayerID=(\w+)
RewriteRule ^some-seo-text-(\w+)-(\w+)\.html /index.php?c=$1&m=$2&token=%1&payerid=%2 [L]
RewriteCond %{QUERY_STRING} token=(\w+-\w+)
RewriteRule ^some-seo-text-(\w+)-(\w+)-(\w+)\.html /index.php?c=$1&m=$2&token=%3 [L]
RewriteCond %{QUERY_STRING} token=(\w+-\w+)
RewriteRule ^some-seo-text-(\w+)-(\w+)\.html /index.php?c=$1&m=$2&token=%1 [L]
RewriteCond %{QUERY_STRING} session=(.*)
RewriteRule ^some-seo-text-(\w+)-(\w+)\.html /index.php?c=$1&m=$2&session=%1 [L]
## Custom Rules
RewriteRule ^some-seo-text-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)\.html$ /index.php?c=$1&m=$2&v1=$4&v2=$6&v3=$8 [L]
RewriteRule ^some-seo-text-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)\.html$ /index.php?c=$1&m=$2&v1=$4&v2=$6 [L]
RewriteRule ^some-seo-text-(.*)-(.*)-(.*)-(.*)\.html$ /index.php?c=$1&m=$2&v1=$4 [L]
RewriteRule ^some-seo-text-(.*)-(.*)\.html$ /index.php?c=$1&m=$2 [L]
RewriteRule ^some-seo-text-(.*)-(.*)\.html$ /index.php?c=$1&m=$2 [L]
RewriteRule ^some-seo-text-(.*)\.html$ /index.php?c=$1 [L]
## Directory Cloaking
RewriteRule ^images/another-seo-text-(.*)$ /static/images/$1 [L]
RewriteRule ^deals/another-seo-text-(.*)$ /static/images/campaigns/$1 [L]
RewriteRule ^css/(.*)$ /static/stylesheets/$1 [L]
RewriteRule ^js/(.*)$ /static/javascripts/$1 [L]
RewriteRule ^captcha/(.*)$ /static/captcha/$1 [L]
答案 0 :(得分:1)
请注意,(.*)
将很乐意匹配网址中的-
,这使得其中许多匹配模糊不清,并且可能非常缓慢。你的\w
匹配可能更有意义。
您可以将diff(1)
粘贴到上次知道的良好工作.htaccess
和此之间吗?这有助于您快速找到故障。