1
htaccess我想重定向一些網址到一些其他的網址與他們的參數,我這樣做這個規則,但它不工作,我做錯了什麼?htaccess重定向到一個網址與動態參數
我有類似www.example.com/ranges/some-of-the-range
的URL,我想將所有這些重定向到www.example.com/info/ranges/some-of-the-range
。
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
RewriteRule ^(ranges/.+)$ /info/$1 [R=301,L,NC]
# non www to www Redirect
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
# Blog URL Issue
RewriteCond %{REQUEST_URI} !^/blog
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule^index.php [L]
</IfModule>
請同時建議以更專業的方式學習.htaccess。
嗨,Anubhava,它不工作,我已經更新了更好的理解:( –
我的規則適用於我的Apache和重定向'/範圍/一些問題範圍'到'/ info/ranges/some-of-the-range'。確保這是你的.htaccess中'RewriteEngine On'行下的第一條規則。 – anubhava
我已經更新了我的所有.htaccess在這裏,請查看 –