簡體   English   中英

我應該在htaccess中重寫的網址上放置重定向嗎?

[英]Should I place a redirect on a url that is rewritten in htaccess?

例如

RewriteEngine On
RewriteRule    ^tour/?$    tour-info.php    [NC,L] 

www.site.com/tour/將在www.site.com/tour-info.php中查找

我的問題是:將www.site.com/tour-info.php保留為可尋址的URL是不好的SEO做法,還是應該在其上放置重定向?

UPDATE

如果您有下面的htaccess代碼...如何使用正則表達式使其更有效? 另外,就SEO而言,應該將諸如“ tours / a.php”之類的可訪問頁面重定向回“ tours / a /”還是首頁?

我正在更新我的網站的網址結構。 我正在重寫的網址尚未被抓取。

RewriteEngine on
Options -Indexes
RewriteRule ^tours/?$ tours.php
RewriteRule ^tours/a/?$ tours/a.php
RewriteRule ^tours/b/?$ tours/b.php
RewriteRule ^tours/c/?$ tours/c.php
RewriteRule ^tours/d/?$ tours/d.php
RewriteRule ^tours/e/?$ tours/e.php
RewriteRule ^tours/f/?$ tours/f.php
RewriteRule ^tours/g/?$ tours/g.php

設置301重定向,以便索引舊網址的所有內容都將指向新網址:

RewriteCond %{THE_REQUEST} \+ /tour-info\.php(\?|\ |$)
RewriteRule ^ /tour/ [L,R=301]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM