1.

Solve : .htaccess RewriteRule map URL to another?

Answer»

hi,

I've developed a web program and let say the main URL is http://domain.com

I will be distributing different URLs for different users, say http://domain.com/user1
and http://domain.com/user2

however, both this URLs will be pointing to the base code at http://domain.com
depending on whether is user1 or user2, the SYSTEM configuration will extract from the respective database.

my question is, how do i use mod_rewrite to map the different urls to the main url with transparency.

I've managed to do it with alias in httpd.conf. e.g:
alias /user1 /var/www/html/myproject
alias /user2 /var/www/html/myproject

however, if i were to do this, i would have to RESTART apache every time i've got a new user. so i've decided to use .htaccess INSTEAD but realised that alias is not availble for it.

I've tried with rewriterule but with no success.

Please advise. thank youhttp://www.linuxquestions.org

Go there and ask.
Quote from: mr-bisquit on April 18, 2010, 01:08:09 PM

http://www.linuxquestions.org

Go there and ask.
Yes, there are many helpful people at Linux Questions who could help you with this.thanks GUYS. that nv cross my mindThere are also plenty of people here who could help.

Code: [Select]Options +FollowSymLinks
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]

RewriteRule ^/user([0-9]+)$ user\.php?id=$1 [QSA,L,NC]


Discussion

No Comment Found