getting querystring from subdomain

Using a single web hosting account to host multiple sites

getting querystring from subdomain

Postby tpad » Mon Dec 01, 2008 1:53 pm

Hello mod_rewrite forum members,
I am here to ask you for help with my website. All I need is thomas.example.com to refer to example.com/name.php?name=thomas.

Thanks a lot in advance,
~tpad
tpad
 
Posts: 4
Joined: Mon Dec 01, 2008 1:49 pm

Postby richardk » Mon Dec 01, 2008 3:34 pm

FAQ: Virtual sub domains. Post here if you have questions about it.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby tpad » Tue Dec 02, 2008 8:18 am

i've looked into that faq and I've tried placing the following htaccess in the folder own

Code: Select all
RewriteEngine On
RewriteRule ^/(.*)$ /own.php?personname=%2 [QSA,L]


to no avail.

The error given(when /own/name is requested) is:
Code: Select all
Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.
Error 404


Thank you very much,
tpad
tpad
 
Posts: 4
Joined: Mon Dec 01, 2008 1:49 pm

Postby richardk » Wed Dec 03, 2008 8:05 am

You're missing quite a bit from that post.
Code: Select all
Options +FollowSymLinks

RewriteEngine On

# Rewrite sub domains.
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} !^(www\.)?example\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.example\.com$ [NC]
RewriteRule ^(.*)$ /name.php?name=%2&request_uri=$1 [QSA,L]


What is supposed to happen if they go to thomas.example.com/something_here?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby tpad » Wed Dec 03, 2008 8:49 am

what was supposed to happen is when someone goes to hisname.example.com it would redirect him to example.com/name.php?personname=hisname.

And that script would treat hisname accordingly
That's all.

Regards,
tpad
tpad
 
Posts: 4
Joined: Mon Dec 01, 2008 1:49 pm

Postby richardk » Wed Dec 03, 2008 8:53 am

what was supposed to happen is when someone goes to hisname.example.com it would redirect him to example.com/name.php?personname=hisname.

I know that. But what if there is /something_here? Should it work as if it wasn't there? Should it redirect to remove it? Should it send a 404 error?

Have you tested the mod_rewrite? Does it work?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby tpad » Wed Dec 03, 2008 9:04 am

I got it activated so I think it does work. When someone writes something there it should be ignored
tpad
 
Posts: 4
Joined: Mon Dec 01, 2008 1:49 pm

Postby richardk » Wed Dec 03, 2008 9:33 am

When someone writes something there it should be ignored

Then the current mod_rewrite should be fine. You can remove
Code: Select all
&request_uri=$1

if you want.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 25 guests

cron