简体   繁体   English

重构网站和htaccess(SEO问题)

[英]Refactoring website and htaccess (SEO issues)

We will refactor a website with about 7000 pages. 我们将重构一个约有7000页的网站。

Today all pages are in form of 今天所有页面的形式

http://www.domain.com/locality/id-name-of-the-shop.html

Of course the important is the ID, but the locality and name of the shop have some form of "slug" to bypass problem of accented chars (à / è / ì) / umlaut / etc. 当然,重要的是ID,但是商店的位置和名称具有某种形式的“子弹”,可以绕过带重音符号(à/è/ì)/ umlaut /等问题。

We cannot mantain "old style" of links, so I think: 我们无法保留链接的“旧样式”,因此我认为:

1 - in htaccess first of all I make 301 redirects to .html version to our "no-extension" version ( http://www.domain.com/locality/id-name-of-the-shop ) 1-首先,我在htaccess中将301重定向到.html版本,我们的“无扩展名”版本( http://www.domain.com/locality/id-name-of-the-shop

2 - Sure several link will be different, the links with the accented chars (I presume about the 10-15% of total links). 2-确保几个链接会有所不同,带有重音符号的链接(我估计大约占总链接的10-15%)。 So I'll have two links for same content (eg http://www.domain.com/locality/832 -metrò and http://www.domain.com/locality/832-metro ). 因此,我将为相同的内容提供两个链接(例如, http: //www.domain.com/locality/832-metrò和http://www.domain.com/locality/832-metro )。 Or, more difficult http://www.domain.com/l+aquila/5482-name-of-the-shop.html and http://www.domain.com/l-aquila/5482-name-of-the-shop.html 或者,更困难的http://www.domain.com/l+aquila/5482-name-of-the-shop.htmlhttp://www.domain.com/l-aquila/5482-name-of- the-shop.html

This (for me) drama because I'm using a framework with his slug engine, very powerful, and I would no modify / extend this. (对我来说)这部戏是因为我正在使用带有他的强大引擎的框架,功能非常强大,并且我不会修改/扩展它。 Neither I cannot surfing for 7000 pages and write down by hand the redirects :) 我也无法浏览7000页并手动写下重定向:)

Could you give me a hint to proced? 您能给我一个继续进行的提示吗? Thank you very much and have nice holiday! 非常感谢您,祝您假期愉快!

The "no extension" thing is pretty easy, but the canonicalization of the extended latin characters to the ascii version will be a little more difficult. “没有扩展名”很容易,但是将扩展的拉丁字符规范化为ascii版本将更加困难。 You're going to need to enumerate them to cover the ones that you expect to have. 您将需要枚举它们以涵盖您期望拥有的那些。

RewriteEngine On

# no extension
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+/[0-9]+-[^/.]+)\.html$ /$1 [L,R=301]

# redirect extended latin characters
RewriteRule ^(.*)à(.*)$ /$1a$2 [L,R=301]
RewriteRule ^(.*)è(.*)$ /$1e$2 [L,R=301]
RewriteRule ^(.*)ì(.*)$ /$1i$2 [L,R=301]
# etc.

# redirect + to -
RewriteRule ^(.*)\+(.*)$ /$1-$2 [L,R=301]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM