0
我是新使用htaccess的,我想知道我有3個網址,我想重寫到同一文件夾htaccess的多個重寫URL到同一文件夾
/articles-pages.php?page_name=$1
/articles-posts.php?page_name=$1
/articles-interviews.php?page_name=$1
,並希望他們都重寫文章/ $ 1
是否有可能或者我必須將它們置於單獨的文件夾下。任何幫助將非常感激。
更新:我htaccess文件看起來像這樣
ErrorDocument 404 http://www.about-muscle.com/404.php
ErrorDocument 500 http://www.about-muscle.com/500.php
RewriteEngine On
RewriteCond %{QUERY_STRING} (?:^|&)page_name=([^&]+)(?:&|$) [NC]
RewriteRule ^articles-(interviews|pages|posts)\.php$ /articles/%1? [R=301,L,NE]
RewriteEngine on
RewriteRule ^(index\.php|bodybuilding\-links\.html) - [L]
RewriteRule ^(index\.php|bodybuilders\-links\.html) - [L]
RewriteRule ^(index\.php|personal\-training\-links\.html) - [L]
RewriteRule ^(index\.php|fitness\-links\.html) - [L]
RewriteRule ^(index\.php|supplements\-links\.html) - [L]
RewriteRule ^(index\.php|nutrition\-links\.html) - [L]
RewriteRule ^(index\.php|female\-fitness\-links\.html) - [L]
RewriteRule ^(index\.php|weight\-loss\-links\.html) - [L]
RewriteRule ^(index\.php|magazine\-links\.html) - [L]
RewriteRule ^(index\.php|equipment\-links\.html) - [L]
RewriteRule ^(index\.php|health\-links\.html) - [L]
RewriteRule ^(index\.php|other\-links\.html) - [L]
RewriteRule ^(index\.php|links\.html) - [L]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^about-muscle.com
RewriteRule (.*) http://www.about-muscle.com/$1 [R=301,L]
RewriteEngine On
RewriteRule ^(.*)\.html$ $1.php
Options +FollowSymLinks
RewriteEngine on
RewriteRule exercises/name/(.*)/ exercises/detail.php?name=$1
RewriteRule exercises/name/(.*) exercises/detail.php?name=$1
RewriteEngine on
RewriteRule exercises/muscle/(.*)/ exercises/muscle.php?page_name=$1
RewriteRule exercises/muscle/(.*) exercises/muscle.php?page_name=$1
RewriteEngine on
RewriteRule exercises/type/(.*)/ exercises/type.php?page_name=$1
RewriteRule exercises/type/(.*) exercises/type.php?page_name=$1
RewriteEngine on
RewriteRule exercises/equipment/(.*)/ exercises/equipment.php?page_name=$1
RewriteRule exercises/equipment/(.*) exercises/equipment.php?page_name=$1
RewriteEngine on
RewriteRule exercises/mechanics/(.*)/ exercises/mechanics.php?page_name=$1
RewriteRule exercises/mechanics/(.*) exercises/mechanics.php?page_name=$1
RewriteEngine on
RewriteRule exercises/force/(.*)/ exercises/force.php?page_name=$1
RewriteRule exercises/force/(.*) exercises/force.php?page_name=$1
RewriteEngine on
RewriteRule writers/(.*).php writers/$1/
RewriteRule writers/(.*)/ writer-pages.php?page_name=$1
RewriteRule writers/(.*) writer-pages.php?page_name=$1
RewriteEngine on
RewriteRule go/(.*)/ goto.php?m=$1
RewriteRule go/(.*) goto.php?m=$1
感謝您的回覆,但@anubhava是不工作。任何想法是爲什麼,或者我還可以嘗試什麼。 –
提供儘可能多的細節。 '不工作'並不能告訴我任何有關這個問題的信息。什麼網址不起作用?你有什麼錯誤?你的.htaccess位於哪裏?那裏有什麼其他的規則(如果有的話)等等等等 – anubhava
嗨@anubhava,沒有一個頁面正在被重寫。他們只是返回一個404頁面未找到。 –