CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Apache configuration (http://www.codingforums.com/forumdisplay.php?f=69)
-   -   .htaccess redirect a folder within a folder (http://www.codingforums.com/showthread.php?t=275906)

ben1390 10-09-2012 05:17 PM

.htaccess redirect a folder within a folder
 
Hi All,

I have a folder within a folder that needs redirecting, for example:

http://www.domain.com/directory/folder1 which needs re-directing to http://www.domain.com/directory/folder2 and have been using the following code:

Code:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)/folder1/(.*)$ $1/folder2/$2 [R,L]

However this is re-directing to http://www.domain.com/var/www/vhosts...ctory/folder2/

Any ideas how to fix this?

patryk 10-14-2012 06:53 PM

people love rewrite these days... ;)

if you want redirect http://example.com/testdir/dir1/ to http://example.com/testdir/dir2/
you put yhis in .htaccess :
Code:

Redirect 301 /testdir/dir1/ /testdir/dir2/
Rewrite is for rewriting
Redirect for redirecting

ben1390 10-15-2012 12:27 PM

Hi patryk

Thanks for that, much appreciated and I always get my rewrites and redirects confused ;)


All times are GMT +1. The time now is 04:05 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.