Click to See Complete Forum and Search --> : mod_rewrite help PLEASE
jennides
10-14-2002, 12:36 AM
I am complete novice when it comes to apache so I am hoping someone can offer me some advice.
What I am trying to do is modify my server (I'm on a shared machine so don't have root access. I have to use an .htaccess file) so that anything.mydomain.com resolves to www.mydomain.com
The tech support guys said it could be done with mod-rewrite and gave me the URL to the appropriate section of the apache manual, but that's where their support ended.
I've read through that part of the manual a couple of times but I can't make heads or tails of it.
Can anyone help?
JeNNiDeS
dotwebbie
10-14-2002, 12:01 PM
Boy, I'm lucky. My host will give me wildcard dns without my intervention. :p Okay, enough on that. What is the url they gave you?
jennides
10-14-2002, 02:07 PM
Well, actually wildcard DNS has been turned on, so they say, but I am required to create individual directories in my /htdocs/ directory in order to activate that subdomain, but this is not at all what I want to do. I simply want whatever.mydomain.com to resolve to www.mydomain.com/index.php
Here's the link to the apache manual on mod_rewrite
http://httpd.apache.org/docs/mod/mod_rewrite.html
Here's what I was recommended to try:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.*)\.profitmatic.com$ [NC]
RewriteRule ^(.*)$ http://www.profitmatic.com/$1?subdom=%1
But when trying to access www.mydomain.com it just causes my browser to hang and eventually return "Cannot Find Server error. Also, the URL in the address bar turns to this:
http://www.mydomain.com/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/www/?subdom=www
dotwebbie
10-14-2002, 02:43 PM
RewriteEngine on
RewriteCond %{HTTP_HOST} !^203.31.191.32(:80)?$
RewriteCond %{HTTP_HOST} !^www.pseudo.com.au(:80)?$
RewriteRule ^/(.*) http://www.pseudo.com.au/$1 [L,R]
RewriteOptions inherit
Here is the site. http://list.cobalt.com/pipermail/cobalt-users/2002-March/065703.html
PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved.