我正在建立一个比我通常习惯使用定制的CMS系统更复杂的网站,并且遇到了绊脚石。
基本上我想要实现的是一个简单的顶级页面结构,所以网址是干净的,如下所示:
http://www.mywebsite.com/page.php?page_url=val1
通常不是问题,但现有的.htaccess已经存在多个RewriteRules,并且添加RewriteRule的任何变体都会发生冲突并阻止选择页面工作。
试图围绕......
RewriteCond %{QUERY_STRING} ^page=(.+)
RewriteRule ^$ /%1? [R=301,L]
没有快乐。
我是否需要重新考虑我的策略,或者我只是简单地忽略了什么?
我是否应该重新思考制作顶级类别页面'market.php'在#Specify MARKET LEVEL重写中重写工作
我现有的.htaccess如下所示,经过全面测试后工作正常,但更改为包含新的顶级页面会导致错误。
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
# Force search engines to use www
RewriteCond %{HTTP_HOST} !^www\.mywebsite\.com$
RewriteRule ^(.*) http://www.mywebsite.com/$1 [R=301,L]
# Specify MARKET LEVEL rewrite
RewriteRule ^top-level-category-1$ /market.php?p=top-level-category-1 [L]
RewriteRule ^top-level-category-2$ /market.php?p=top-level-category-2 [L]
RewriteRule ^top-level-category-3$ /market.php?p=top-level-category-3 [L]
RewriteRule ^top-level-category-4$ /market.php?p=top-level-category-4 [L]
RewriteRule ^top-level-category-5$ /market.php?p=top-level-category-5 [L]
RewriteRule ^top-level-category-6$ /market.php?p=top-level-category-6 [L]
Options +FollowSymLinks
# Specify OFFER LEVEL rewrite
RewriteRule offer/(.*)/ offer.php?p=$1
RewriteRule offer/(.*) offer.php?p=$1
# Specify CLAIM OFFER LEVEL rewrite
RewriteRule get-offer/(.*)/ reveal.php?claim=$1
RewriteRule get-offer/(.*) reveal.php?claim=$1
# Specify CLAIM EVENT LEVEL rewrite
RewriteRule event-bonus/(.*)/ reveal-event.php?claim=$1
RewriteRule event-bonus/(.*) reveal-event.php?claim=$1
# Specify SEARCH LEVEL rewrite
RewriteRule search/(.*)/ search.php?p=$1
RewriteRule search/(.*) search.php?p=$1
# Specify EVENT LEVEL rewrite
RewriteRule offers/(.*)/ offers.php?p=$1
RewriteRule offers/(.*) offers.php?p=$1
# Specify BLOG LEVEL rewrite
RewriteRule blog/(.*)/ blog.php?p=$1
RewriteRule blog/(.*) blog.php?p=$1
RewriteRule view-blog/(.*)/ view-blog.php?p=$1
RewriteRule view-blog/(.*) view-blog.php?p=$1
# Specify EXPIRED OFFER LEVEL rewrite
RewriteRule offer-expired/(.*)/ offer-expired.php?p=$1
RewriteRule offer-expired/(.*) offer-expired.php?p=$1
答案 0 :(得分:0)
尝试在RewriteRule
.htaccess
RewriteEngine On
RewriteRule ^([^/]*)$ /page.php?page_url=$1 [L]
它应该为您留下所需的网址。