English 中文(简体)
301 朝向
原标题:301 redirection in htaccess
  • 时间:2012-04-28 13:08:49
  •  标签:
  • .htaccess

我为我的网站打上了通道,我需要把旧的ur改到新的尿道,直到301次。 我制定了如下手提法:

My old urls like

 www.example.com/categories/city/cityname/brandname/product1.html

和我的新任王一样

 www.example.com/product1.html

For this scenario I have written following code in htaccess

 RedirectMatch 301 ^/categories/city/cityname/(.*)$ http://www.example.com/$1

请帮助我了解这种情况,或我错了。

问题回答

在你获得的照片中,使用 mo改板功能,如:

RewriteEngine On
RewriteRule ^/categories/city/cityname/(.*)$ /$1 [R=301,L]

在谈到@Seybsen的答复时,这1行应符合你们的所有需要:

RewriteRule ^/([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z]+)/(.*)$ /$5 [R=301,L]




相关问题
Ignore symlinks in clean URL s in .htaccess

Example URL: example.com/user /user is both a symlinked directory and a valid URL to content on my site. I user Horde Routes to request the content and all requests to the site go through index.php. ...

.htaccess File Options -Indexes on Subdirectories

I have the following .htaccess line, simple no indexes on root. Options -Indexes What do we add so it propagates to any sub directory instead of having to create one file for each? One .htaccess on ...

Mod Rewrite ignoring -d

After a day or two, I am still fighting with Mod Rewrite. It seems that 60% of my development time is spent battling the server. My current URL structure is such that all http://example.com/xyz and ...

ErrorDocument 404 Not Sending Referrer Information: PHP

I m using a standard htaccess ErrorDocument 404 to redirect users to a new page. In order to customize the 404, I need to know their referrer information (from the page they Tried to visit). $...

Find all htaccess files on server [closed]

I m looking for a Linux command to go through all the directories on my server and find all .htaccess files. The output would be a list of all those files with full path, creation/modification date ...

301 Redirect Help with Dynamic URL s and Multiple Id s

I just did a redesign for www.wildchildclothes.com which has a new URL structure. The old site ran on Zen Cart and had a bad URL structure. Here are some examples of what I want to redirect from: OLD:...

热门标签