Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.