Solved

.HTACCESS Rewrite Rule 301

Posted on 2013-05-13
3
357 Views
Last Modified: 2016-03-02
Hi,

I have various hundred URL's that have been indexed in google and I need to resolve them and redirect them. The pattern is like this:

www.mydomain.com/en/decor/somefolder-1/somepage-1.html?p=4
www.mydomain.com/it/somepage-1.html
www.mydomain.com/es/somefolder/anotherfolder-1/somepage.html

The CMS I use, Magento, has a rewrite module that fails sometimes and adds -1 to folders and to .html files.

As you can see, I would need a rewrite rule that would take off the -1 for the folders and the -1 just before the .html for pages.

I would need it to 301 the incoming requests based on above and rewrite them to:

www.mydomain.com/en/decor/somefolder/somepage.html?p=4
www.mydomain.com/it/somepage.html
www.mydomain.com/es/somefolder/anotherfolder/somepage.html

Your help is greatly appreciated.

thanks!
0
Comment
Question by:intangiblemedia
  • 2
3 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 500 total points
ID: 39163624
RewriteRule %{REQUEST_URI} ^(.*)-[0-9]*/(.*\.html) $1/$2 [QSA]
RewriteRule %{REQUEST_URI} ^(.*)-[0-9]*(\.html) $1$2 [QSA]
0
 

Author Comment

by:intangiblemedia
ID: 39163838
thanks for your answer - I tried them, but both give me http 500 errors and site doesnt load...
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 39163859
can you please post the corresponding entry from your error-log
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
This article discusses four methods for overlaying images in a container on a web page
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now