0
任何人可以幫助我優化和修復我的.htaccess文件?在正則表達式中我真的很糟糕,而且我不是服務器的人,我正在構建的網站由於錯誤而無法訪問。任何幫助將非常感激。轉貼: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]
感謝sarnold。我實際上以某種方式解決了錯誤(我不記得如何),但優化確實是我的優先事項之一。你能建議上面的代碼應該如何? – 2011-04-08 05:19:52
@Jhourlad埃斯特雷亞,請嘗試更換所有的'(*)'和'(\ w +)'匹配,並嘗試看看是否是重寫速度/性能的任何改善。其他人可能有更好的想法來優化重寫規則,所以你可能想要打開一個新的問題並尋求優化建議。 (準備讓別人問你現在有沒有實際上是一個問題 - 如果它不明顯慢,那麼可能不值得嘗試改進。:) – sarnold 2011-04-08 22:58:38