0
我有以下重寫規則,但每次重新啓動Apache時,都會阻止Apache重新啓動並失敗。Apache重新啓動後mod_rewrite規則失敗
一個錯誤是...
Starting httpd: Syntax error on line 82 of /var/www/vhosts/current_release/url-rewrite-maps/catchall.txt: RewriteRule: cannot compile regular expression '^/ProductDetails\.aspx\?PromotionID\(.*)\&id\(.*)$' [FAILED]
RewriteRule ^/ProductSearch\.aspx\?Ntt\=(.*)\&N\=(.*)$ catalogsearch/result/?q=$2 [R=302,L,NC]
#old search redirect to search
RewriteRule ^/ProductSearch\.aspx\?viewall\=1\&N\=(.*)$ productsearch.aspx?N=$1 [R=302,NC]
#viewall with N parameter to another redirect rule for URL with N= value only
RewriteRule ^/ProductSearch\.aspx\?(Ne|No)\=(.*)\&N\=(.*)$ productsearch.aspx?N=$3 [R=302,NC]
#url with Ne OR No param and N= to productsearch.aspx redirect on URLs with N= only
RewriteRule ^/ProductDetails\.aspx\?PromotionID\=(.*)\&id\=(.*)$ productdetails.aspx?id=$2 [R=302,NC]
#should pass the PID into the ID= and redirect from there
RewriteRule ^/ProductDetails\.aspx\?id\=(.*)\&RSSLINK\=(.*) productdetails.aspx?id=$1 [R=302, NC]
感謝,
布拉德
我有一系列指向不同重寫映射文件的指針,每個指針都有一個條件和兩條規則,並且在這些特定示例的結尾處包含一個catchall.txt。那麼,你可以在這樣的包含文件中使用RewriteCond嗎? (無論如何要嘗試......) – Brad
查看編輯我的答案:-) – TerryE
我最終不得不將重寫條件放在apache .conf中,而不是放在我單獨的catchall文件中。在你描述的所有陳述之後,我最終沒有使用這個傳奇,它給我帶來了其他問題。 – Brad