Solved

.HTACCESS Rewrite Rule 301

Posted on 2013-05-13
3
383 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

734 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