|
-
Jan 3rd, 2006, 08:05 AM
#1
Thread Starter
Frenzied Member
.htaccess help needed
I'm trying to write a redirect statement in the .htaccess file for the following:
1. All pages on one domain redirect to a single page on another domain say http://www.somesite.com/somepage.php
2. The exception to this is any pages within the cpanel directory which should not redirect at all.
I know this needs to be done with regular expressions but all the attempts I have tried so far do not work!
Help!
DJ
If I have been helpful please rate my post. If I haven't tell me!
-
Jan 5th, 2006, 02:18 PM
#2
Addicted Member
Re: .htaccess help needed
I guess you can use something like;
Code:
RewriteEngine On
RewriteRule ^/(.*) htp://somesite.com/somepage.php [R=301,L]
I haven't tested though.
-
Jan 6th, 2006, 04:03 AM
#3
Thread Starter
Frenzied Member
Re: .htaccess help needed
I can redirect everything it's just the exception of the one directory that is causing the problem.
DJ
If I have been helpful please rate my post. If I haven't tell me!
-
Jan 6th, 2006, 03:15 PM
#4
Addicted Member
Re: .htaccess help needed
Right, I'm not entirely sure how you might be able to do that actually. :/
-
Jan 7th, 2006, 12:29 PM
#5
Fanatic Member
Re: .htaccess help needed
 Originally Posted by Dayjo
I guess you can use something like;
Code:
RewriteEngine On
RewriteRule ^/(.*) htp://somesite.com/somepage.php [R=301,L]
I haven't tested though.
I have just spent all day making fancy smashy urls work for http://lordmatt.co.uk so I think I can help (there is a post about it on the front page at the moment).
You will need two rules:
Code:
RewriteRule ^cpanel(.*)$ http://etc/cpanel/$1 [L,NC]
RewriteRule ^(.*)$ http://otherdomain.com/$1 [L,NC]
rule one is case insensitive and redirects the cpanel directory to iteself (silently) and more importantly the [L] directive stops .htaccess from doing any more mod_rewrites on the URL.
If we didn't make it to cpanel then we must be the otehr case (everything else). The second one makes all calls to the current domain go to otherdomain.com (add your own here) AND it will pass over any other instructions etc so myfirstone.com/folder/special.html would now map to otherdomain.com/folder/special.html
If this is not wanted remove the $1 from towards the end of the second line.
if you want people to know that everything has moved than unhide the rewrite and make [L,NC] become [R=301,NC] which redirects with the permanant moved message. (good for search engines).
You will need to have
at the begining of the file and it would not hurt to have
Code:
Options +FollowSymlinks
before that
this gives us
Code:
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^cpanel(.*)$ http://etc/cpanel/$1 [L,NC]
RewriteRule ^(.*)$ http://otherdomain.com/$1 [L,NC]
This should work as it is based one what I've done for old dead links on my site (the dead links are on other people sites).
-
Jan 10th, 2006, 07:09 AM
#6
Thread Starter
Frenzied Member
Re: .htaccess help needed
Hi Matt
Unfortunately I've given your suggestion a try and it seemed to do nothing! Any ideas why?
Cheers
DJ
If I have been helpful please rate my post. If I haven't tell me!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|