Solved

.HTACCESS Rewrite Rule 301

Posted on 2013-05-13
3
364 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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

912 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

18 Experts available now in Live!

Get 1:1 Help Now