mod_rewrite and sub-domains

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

mod_rewrite and sub-domains

Post by alex.barylski »

After reading up a little more I think? it's important to also note that login.php is acting as both a FORM input script as well as a login request handler - so I need to propagate POST data?

Here is the situation:

I have these files in DOCROOT:

Code: Select all

index.php
login.php
admin.php
My .htaccess looks like:

Code: Select all

RewriteEngine on
RewriteBase /

RewriteRule ^assets/ - [L]
RewriteRule ^admin.php - [L]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
Works awesome but now...

instead of users accessing login.php like:

Code: Select all

www.domain.com/login.php
I would much prefer they use:

Code: Select all

https://login.domain.com
Notice how I need login.php to be mapped to a sub-domain (or visa versa) as well as HTTPS protocol to be used.

I don't have SSL enabled yet and I will have to read up a bit more on enabling it, but can someone show me what needs to be added to either .htaccess or apache.conf (actually virtual host setup on debian).

Keeping the three files above all inside the document root as is, is absolutely required/desired - unless I have to move login to an actual directory outside of root I don't want to... :)

Cheers :)
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

You can set up a virtual host login.domain.com that redirects all requests to the script login.php
Post Reply