logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: rewrite for any directory
Author
fabianus



Joined: 15 Oct 2014
Posts: 1

PostPosted: Wed 15 Oct '14 20:15    Post subject: rewrite for any directory Reply with quote

Hello all,

I would like to write a rewrite rule that does the following:

RewriteEngine On

Redirect 301 http://www.mydomain.com/someFolder1/someOtherFolder2/myWebPage.aspx http://www.mydomain.com/myNewWebPage.html


So what I want is that the first url is rewritten to go to the second ... BUT, now comes the problem:
I have a whole bunch of links that I have to redirect, so I would like to place them all into one .htaccess file or into the default configuration file of apache. So what I do not want is to create SomeFolder1 and someOtherFolder2 and to place a .htaccess file into that place in order to make it work. In fact I want to ignor the folders of the old link and only use the pagename. I tried this:

Redirect 301 http://www.mydomain.com/[*]myWebPage.aspx http://www.mydomain.com/myNewWebPage.html

But it doesn't work ...

I hope I was clear enough and thanks a lot for any suggestion.

Best regards,
Fabianus
Back to top
maba



Joined: 05 Feb 2012
Posts: 64
Location: Germany, Heilbronn

PostPosted: Wed 22 Oct '14 20:50    Post subject: Reply with quote

Check out the documentation for RedirectMatch.

Redirect (as the name suggests) will not do patterns. RedirectMatch will.

If this is still not flexible enough go with Rewrite.
Back to top


Reply to topic   Topic: rewrite for any directory View previous topic :: View next topic
Post new topic   Forum Index -> Apache