Jump to content

Redirect a domain to a specific page


watsmyname

Recommended Posts

Hello,

 

I m having trouble redirecting my domain . Lets say i have the domain www.mysite.com. All I want is whenever user types my domain www.mysite.com or mysite.com they should redirect to www.mysite.com/landing_page.php. While www.mysite.com/index.php  and all other pages should not redirect. I tried using RedirectMatch, but didnt work i got a redirect loop. Is there any way to do this using .htaccess ??

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/241201-redirect-a-domain-to-a-specific-page/
Share on other sites

Sticking something like this in a .htaccess file in your root directory should do the job...

 

RewriteEngine On
RewriteRule ^$ /landing_page.php [R=301,L]

 

Alternatively you could consider renaming the landing_page.php to index.php and move the home page into www.mysite.com/home/

As far as I can remember NC stands for NoCase which basically means make the Regex pattern non-case sensitive. Since your Regex pattern is empty, there's not a great deal of point leaving that one in there. Glad you got it working though.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.