[英]How to redirect old url to new url using .htaccess file in codeigniter?
我的舊網址:
http://www.mywebsite.com/view-college?college_name=Shri%20Ram%20College%20of%20Commerce,%20New%20Delhi%20(commerce)
我的新網址:
http://www.mywebsite.com/college/Shri%20Ram%20College%20of%20Commerce,%20New%20Delhi%20(commerce)
我的 .htaccess 文件
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
RewriteCond %{THE_REQUEST} \s/+(.+)\.php[\s?] [NC]
RewriteRule ^ /%1 [R=301,L,NE]
# To internally rewrite to .php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]
我已將我的核心 php 項目轉換為 codeigniter。 當我像 mywebsite.com 這樣在 google 上搜索我的網站,然后單擊它時,我無疑會訪問我的 codeigniter 網站,但是當我單擊特定頁面時,它會顯示舊網址和 404 錯誤。 那么,我該如何解決?請幫幫我。
謝謝你
view-college
到college
是兩條不同的路線。 我也不知道你的其他路線。 可能你可以用谷歌站長找到所有404頁面並一一修復。
如果你的所有 URL 都有一個模式,你可以遵循這樣的更苗條的模式。
Redirect /view-college(.*)$ /college/$1 [R=301,L]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.