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: Redirecting long pathnames in .htaccess
Author
kurgan



Joined: 30 Jul 2012
Posts: 1

PostPosted: Mon 30 Jul '12 20:17    Post subject: Redirecting long pathnames in .htaccess Reply with quote

We are currently using apache with redhat and I have been setting up redirects using .htaccess for a couple of years but have recently come up with a scenario I'm having trouble with. A partiular redirect was originally setup using:

RewriteCond %{HTTP_HOST} ^www\.blahblah\.com [NC]
RewriteRule ^scott$ http://www.yadayadayada.com/abc/af/nl/abc/core/misc/learn/micrositePage.do?NAME=scott-form&micrositeName=scott-2012&footer=no&topBanner=no [L,R,NE,NC]

It was later changed to the following when the page was changed:

RewriteCond %{HTTP_HOST} ^www\.blahblah\.com [NC]
RewriteRule ^scott$ http://www.yadayadayada.com/dir1/dir2/dir3/dir4/dir5/nav/page.do?NAME=contest-has-ended&micrositeName=contest-has-ended [L,R,NE,NC]


Now I have been asked to setup a 301 redirect pointing the original redirect URL(http://www.yadayadayada.com/abc/af/nl/abc/core/misc/learn/micrositePage.do?NAME=scott-form&micrositeName=scott-2012&footer=no&topBanner=no) to the current redirect URL (http://www.yadayadayada.com/dir1/dir2/dir3/dir4/dir5/nav/page.do?NAME=contest-has-ended&micrositeName=contest-has-ended). Is it even possible to redirect such lengthy paths? If so, how would I go about this? Thanks!
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7306
Location: Germany, Next to Hamburg

PostPosted: Thu 02 Aug '12 9:53    Post subject: Reply with quote

Code:

Redirect 301 /yourdirectory http://example.com/newdirectory


See http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirect

and

http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirectmatch
Back to top


Reply to topic   Topic: Redirecting long pathnames in .htaccess View previous topic :: View next topic
Post new topic   Forum Index -> Apache