Web Hosting Talk


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : .htaccess issues - Redirect
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.

 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-08-2008, 11:33 PM
slingshot slingshot is offline
View Beta Profile
WHT Addict
 
Join Date: Oct 2003
Location: New Jersey
Posts: 108
.htaccess issues - Redirect

I saw another post in here relative to .htaccess and redirecting domains, however, I am not getting the output that I think I desire.

I have a site http://www.oldsite.com and we purchased a new domain and rebuilt the site from scratch. The new domain is http://www.newdomain.com for instance.

We have the need to ensure all traffic forwards to http://www.newdomain.com even if someone visits a bookmark.

The following rewrite example gets me part of the way there and I have tried a couple of modified instances of the rewrite

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.newdomain.\org$ [NC]
RewriteRule ^(.*)$ http://www.newdomain.org/$1 [L,R=301]

When I visit previously bookmarked sites I am taking to the new home page, however I get this as well: http://www.newdomain.com/modules.php...e=print&sid=47 which is still a reference to the old site.

Is there away to get it to drop the garbage at the end? I have tried removing the $1 as suggested in another thread, but to no avail.

Thanks for any assistance.

__________________
Craig M.
Web-Hosting4u - 866.699.9448 Ext. 811
http://www.web-hosting4u.com
Reliable and Affordable Web Hosting

Reply With Quote
Sponsored Links
  #2  
Old 09-09-2008, 06:21 AM
SparkSupport SparkSupport is online now
View Beta Profile
Web Hosting Master
 
Join Date: May 2006
Posts: 642
In the code you gave, you used .org instead of .com ( or was that a typo ?? )

Also, in your code, you used the escape character "\" before the alphabet "o" instead of using it before ".".

Code:
www\.newdomain.\org
Escape character should be used before a special character, not after it.

Try this code:
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} olddomain\.com [NC]
RewriteRule ^(.*)$ http://www.newdomain.com/ [L,R=301]
Good Luck

__________________
SparkSupporT
http://sparksupport.com
sales@sparksupport.com
1- 408-335-0493

Reply With Quote
  #3  
Old 09-09-2008, 07:07 AM
slingshot slingshot is offline
View Beta Profile
WHT Addict
 
Join Date: Oct 2003
Location: New Jersey
Posts: 108
No, the domain in question is a.org to a new .org. I'll try the above.

Thanks.

__________________
Craig M.
Web-Hosting4u - 866.699.9448 Ext. 811
http://www.web-hosting4u.com
Reliable and Affordable Web Hosting

Reply With Quote
Sponsored Links
  #4  
Old 09-10-2008, 04:47 PM
shellcrash shellcrash is offline
View Beta Profile
Newbie
 
Join Date: Sep 2008
Posts: 5
Redirect OLDURL NEWURL

Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement: