Jump to content


Photo

rewrite www. to subfolder


  • Please log in to reply
5 replies to this topic

#1 Talantyyr

Talantyyr

    Newbie

  • New Members
  • Pip
  • 4 posts

Posted 30 October 2013 - 03:13 PM

Hi,

 

I'd like to redirect www.mydomain.com to www.mydomain.com/startpage

 

 

but only for www.mydomain.com   without any page.  e.g. www.mydomain.com/index.php should still work. 

 

How can this be achieved?



#2 requinix

requinix

    Hopeless Member

  • Moderators
  • 5,907 posts
  • LocationWA

Posted 30 October 2013 - 04:16 PM

The request URI will be just a slash, so
RedirectMatch ^/$ /startpage


#3 Talantyyr

Talantyyr

    Newbie

  • New Members
  • Pip
  • 4 posts

Posted 31 October 2013 - 03:31 AM

Thank you!

 

I was messing around with RewriteCond and RewriteRule... ^^

 

 

Edit: 

 

Can i hide the /startpage somehow?

So in this case, if you go to www.mydomian.com i don't want to show the /startpage in the browserbar...


Edited by Talantyyr, 31 October 2013 - 03:34 AM.


#4 Talantyyr

Talantyyr

    Newbie

  • New Members
  • Pip
  • 4 posts

Posted 31 October 2013 - 05:44 AM

Seems i can't edit my post a second time.... :-/

 

This also redirects all subdomain's to /startpage... i only want to redirect www.domain.com.



#5 requinix

requinix

    Hopeless Member

  • Moderators
  • 5,907 posts
  • LocationWA

Posted 31 October 2013 - 12:56 PM

You can "hide" it by doing rewriting instead of redirecting. And to match only that domain you need RewriteCond.
RewriteCond %{HTTP_HOST} =www.domain.com
RewriteRule ^/?$ /startpage [L]


#6 Talantyyr

Talantyyr

    Newbie

  • New Members
  • Pip
  • 4 posts

Posted 05 November 2013 - 09:24 AM

Thank you!

 

But i still have another problem :- (

 

I'm using rewriting for more readable links:

 

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
 
where do i have to put that exactly to get it to work? ( /startpage is a rewrite for the index.php ). It's no really working with my current rewrite code...
 
Thank you for your patience :)





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com