Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Url Redirection/rewrite Using Htaccess
Niru
post Sep 22 2006, 04:47 AM
Post #1


Advanced Member
Group Icon

Group: Members
Posts: 190
Joined: 18-August 06
From: Fun.NiranVv.Com
Member No.: 15,325
myCENTs:41.60



Hi friends,
I need one more help!
My old forum url was: www.fun.niranvv.com
now its changed to www.fun.niranvv.com
I need to redirect all users coming to the old site to the new site!
That is working fine by using redirection at cPanel!
But I ned to redierct the full url paths!

I mean, I need to redirect visitors coming to the page:
www.forum.niranvv.com/viewforum.php?f=RequestedPageNum
to
www.fun.niranvv.com/viewforum.php?f=RequestedPageNum

and also coming to topics:
www.forum.niranvv.com/viewtopic.php?t=RequestedTopicNumber
to
www.fun.niranvv.com/viewtopic.php?t=RequestedTopicNumber

I checked some .htaccess tutorials!
But all are complicating stuffs! sad.gif
And tried some, but didnt worked at all!
unsure.gif

So, anybody please help me to do it with .htaccess file!
Thanks in advance!

This post has been edited by Niran: Sep 22 2006, 04:52 AM
Go to the top of the page
 
+Quote Post
pyost
post Sep 22 2006, 12:25 PM
Post #2


Nenad Bozidarevic
Group Icon

Group: [MODERATOR]
Posts: 1,048
Joined: 7-November 05
From: Belgrade, Serbia
Member No.: 9,500
myCENTs:89.26



Here's a solution that should work. Check out this link. It shows you how to redirect a www page to a non-www one, and vice-versa. In order to use it for changing the subdomain, I guess something like this is what you need.

CODE

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


However, I'm rather sure that there is an error in the code, since I created this by analysing the www redirecting code.
Go to the top of the page
 
+Quote Post
vujsa
post Sep 22 2006, 05:18 PM
Post #3


Absolute Newbie
Group Icon

Group: Admin
Posts: 888
Joined: 20-February 05
From: Indianapolis, Indiana, USA (Midwest)
Member No.: 2,714
myCENTs:35.43



I think this will do what you need.
CODE

RewriteEngine On

RewriteCond %{HTTP_HOST} ^forum.niranvv.com$ [NC]
RewriteRule ^(.*)$ http://fun.niranvv.com/$1 [R=301,L]


Let me know if this doesn't do it for you and I'll tweak the codefor you.

Seems like you are having a lot of trouble getting the website started up. unsure.gif

Hope things start to get easier for you soon.

vujsa
Go to the top of the page
 
+Quote Post
pyost
post Sep 22 2006, 05:51 PM
Post #4


Nenad Bozidarevic
Group Icon

Group: [MODERATOR]
Posts: 1,048
Joined: 7-November 05
From: Belgrade, Serbia
Member No.: 9,500
myCENTs:89.26



Yeah, that's what you need. I just realized an error I made in my code.

CODE
!^fun.niranvv.com$


This part redirects everything that is not fun.niranvv.com to the mentioned subdomain. I guess that would redirect ALL subdomains, which certainly isn't good! vujsa's solution is simple and probably working wink.gif
Go to the top of the page
 
+Quote Post
vujsa
post Sep 22 2006, 11:10 PM
Post #5


Absolute Newbie
Group Icon

Group: Admin
Posts: 888
Joined: 20-February 05
From: Indianapolis, Indiana, USA (Midwest)
Member No.: 2,714
myCENTs:35.43



QUOTE(pyost @ Sep 22 2006, 01:51 PM) *

vujsa's solution is simple and probably working wink.gif


Yeah, I'm funny that way I guess. tongue.gif

The funny thing is that the solution was nearly on the page you refered to but the examples shown weren't very useful.

You code read as follows:
Any url request that does not start with fun.niranvv.com (rewrite condition) should be redirected to fun.niranvv.com (rewrite rule).

Mine reads like this:
Any url request that starts with forum.niranvv.com (rewrite condition) should be redirected to fun.niranvv.com (rewrite rule).

I'm not very good at explaining the regular expresions used to perform the replacements.

vujsa
Go to the top of the page
 
+Quote Post
Niru
post Sep 23 2006, 08:49 AM
Post #6


Advanced Member
Group Icon

Group: Members
Posts: 190
Joined: 18-August 06
From: Fun.NiranVv.Com
Member No.: 15,325
myCENTs:41.60



QUOTE(vujsa @ Sep 22 2006, 10:48 PM) *

I think this will do what you need.
CODE

RewriteEngine On

RewriteCond %{HTTP_HOST} ^forum.niranvv.com$ [NC]
RewriteRule ^(.*)$ http://fun.niranvv.com/$1 [R=301,L]


Let me know if this doesn't do it for you and I'll tweak the codefor you.

Seems like you are having a lot of trouble getting the website started up. unsure.gif

Hope things start to get easier for you soon.

vujsa


Thanks vujsa!
That code is working fonine for me!
Thanks a lot dude!
You guys are doing great! wink.gif Thanks for such a wonderful support friends!
I was little confused by going to those .htaccess tutorial sites!
Now all the visitors coming to my old page is redirecting my new page!
No problems with the code! biggrin.gif

QUOTE(pyost @ Sep 22 2006, 11:21 PM) *

Yeah, that's what you need. I just realized an error I made in my code.

CODE
!^fun.niranvv.com$


This part redirects everything that is not fun.niranvv.com to the mentioned subdomain. I guess that would redirect ALL subdomains, which certainly isn't good! vujsa's solution is simple and probably working wink.gif


Thanks pyost! Got some problems by trying your code! wink.gif
But now its ok after changing the .htaccess file with to vujsa's code!
Anyway, thanks for spending some time for me dude! biggrin.gif


Niran

This post has been edited by Niran: Sep 23 2006, 08:53 AM
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Mod_rewrite Support?(4)


 



- Lo-Fi Version Time is now: 2nd December 2008 - 01:13 AM