Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 26 Jul 2016, 08:40
DCteen DCteen is offline
 
Join Date: Jul 2016
Real name: DCteen
Question How to redirect url in .htaccess ?

Hello VB.org staff & coders

can someone please guide me, how do i redirect an url in .htaccess file

for example - i want to redirect url

http://www.example.com/search.php to http://www.example.net/search.php (same url just domain name is different)


*[i have searched query "how to redirect url in htaccess" before posting this thread but i didn't get anything useful]


Thank you
Reply With Quote
  #2  
Old 26 Jul 2016, 08:47
DivisionByZero's Avatar
DivisionByZero DivisionByZero is offline
 
Join Date: Dec 2002
Real name: Chris
need more information.

just that ONE page (search.php)? or EVERYTHING .com to .net ??
__________________
Professional vB development since 2002.
References & Praise: 1|2|3|4|5|6|7|8
Reply With Quote
  #3  
Old 26 Jul 2016, 08:53
DCteen DCteen is offline
 
Join Date: Jul 2016
Real name: DCteen
everything is done but few left i.e search.php / calander.php etc.. so i guess i have do them one by one ?
Reply With Quote
  #4  
Old 26 Jul 2016, 08:55
DivisionByZero's Avatar
DivisionByZero DivisionByZero is offline
 
Join Date: Dec 2002
Real name: Chris
not necessarily. if you're moving the whole SITE, then you can do it with two lines of code, but if it's only a select few pages, then yes, it will have to be done individually
__________________
Professional vB development since 2002.
References & Praise: 1|2|3|4|5|6|7|8
Reply With Quote
  #5  
Old 26 Jul 2016, 09:04
DCteen DCteen is offline
 
Join Date: Jul 2016
Real name: DCteen
whole SITE's url are redirecting to another already except few So, please guide me how do i do this ? The codes are ?
http://www.example.com/search.php to http://www.example.net/search.php (same url just domain name is different)

--------------- Added 26 Jul 2016 at 09:19 ---------------

also let know the code / procedure how to redirect the whole site to another * (for my knowledge).

For now please let know how to redirect the mentioned URL .

Thank You
Reply With Quote
  #6  
Old 26 Jul 2016, 12:32
KevinL KevinL is offline
 
Join Date: Apr 2005
Whole site to another

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?old\.com
RewriteRule (.*) http://www.new.com/$1 [R=301,L]
Reply With Quote
  #7  
Old 26 Jul 2016, 16:12
DCteen DCteen is offline
 
Join Date: Jul 2016
Real name: DCteen
Question

Originally Posted by KevinL View Post
Whole site to another

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?old\.com
RewriteRule (.*) http://www.new.com/$1 [R=301,L]
Thanks KevinL

Noted ! Can you please let me know how do i redirect particular (Single) link as mentioned above ?

Last edited by DCteen; 26 Jul 2016 at 16:18.
Reply With Quote
  #8  
Old 26 Jul 2016, 21:31
KevinL KevinL is offline
 
Join Date: Apr 2005
Redirect 301 /oldfile.php http://example.net/newfile.php

That should work. But if you use the last one I wrote it should take care of all files and only need that one.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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 On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 01:24.

Layout Options | Width: Wide Color: