开发者

REPOST: htaccess Error and Optimization

开发者 https://www.devze.com 2023-02-20 23:22 出处:网络
Can anybody help me optimize and fix my .htaccess file? I\'m really bad at regex and I\'m not a server person and site I\'m building is inaccessible because of the error. Any help would be very much a

Can anybody help me optimize and fix my .htaccess file? I'm really bad at regex and I'm not a server person and site I'm building is inaccessible because of the error. Any help would be very much appreciated.

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]


Note that (.*) will happily match a - in an URL, making many of these matches ambiguous, and perhaps very slow. Your \w matches probably make more sense.

Can you paste the diff(1) between your last known good working .htaccess and this one? That would help you find the fault quickly.

0

精彩评论

暂无评论...
验证码 换一张
取 消