我需要與改變這個URL更改的特定頁面的URL,使用.htacces
page.com/OLD?q=text+phrase
的只是一部分。這
page.com/NEW?q=text+phrase
請注意:此網址是一個搜索結果,在這種情況下,完整的URL從該部分格式化:
page/
- 域/OLD
- 這部分(路線)需要改變?q=
- 是查詢字符串text+phrase
- 這是一些用戶在搜索框中writen文字,等等,點擊「輸入」這段文字會在URL和用戶的末尾添加將被重定向到「搜索結果頁」
我需要這個重定向只是爲外部URL(由谷歌索引)becouse我已經130.000網址索引(mysite的/老?q = ...)
這是我的實際代碼(這是舊的 - 新的 - 是不是在這個代碼加入,becouse我的意圖,以獲得正確的代碼,有faill)
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php[^/] /$1? [L,R=301,NC,NE]
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php(?:/(.*))?$ /$1$2? [L,R=301,NC,NE]
RewriteRule ^/?filme-online/(.*)$ /online-filme/$1 [L,R=301]
RewriteRule ^/?filme-online(.*)$ /online-filme$1 [L,R=301]
RewriteRule ^/?seriale-online/(.*)$ /online-seriale/$1 [L,R=301]
RewriteRule ^/?seriale-online(.*)$ /online-seriale$1 [L,R=301]
# Redirect Trailing Slashes...
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule^index.php [L]
</IfModule>
您應該添加您爲所需任務所做的嘗試。 – hjpotter92
那麼,我的托盤添加這個新規則 - 重寫規則^ /?舊(。*)$ /新$ 1 [QSA,L,R = 301] – user5535624