Hiya, I have a subdomain: building-a-deck.timesheetsmts.com That I want to rewrite to www.timesheetsmts.com/building-a-deck/ How would you go about doing this in mod-rewrite? Mark
If you use cpanel both should work. If you dont I am not sure how to do it but mod_rewrite should work.
I figured it out, .htaccess works: RewriteCond %{HTTP_HOST} ^[www\.]*sub-domain-name.domain-name.com [NC] RewriteCond %{REQUEST_URI} !^/sub-domain-directory/.* RewriteRule ^(.*) /sub-domain-directory/$1 [L] Code (markup):
Well my webhost allows me to add unlimited type A dns records free of charge. So with .htaccess I can indeed park unlimited domains.
I'm a full on newbie on this. Here's what I'm trying to do. Any direction would be great: subdomain = wanaka.snowcommunity.com server path to subdomain = /hsphere/local/home/ccharp/wanaka.snowcommunity.com domain = snowcommunity.com server path where I want the rewrite to = /hsphere/local/home/ccharp/snowcommunity.com/wanaka/ I've managed to get a mod_rewrite that redirects wanaka.snowcommunity.com to http://www.snowcommunity.com/wanaka/. But what I'd prefer is for wanaka.snowcommunity.com to remain in the address bar (a rewrite). The trouble is that the subdomains folder is not on the same path as snowcommunity.com Here is my mod_rewrite so far: RewriteEngine On Options Indexes FollowSymlinks Multiviews RewriteBase / RewriteCond %{HTTP_HOST} wanaka.snowcommunity.com RewriteCond %{REQUEST_URI} !wanaka/ RewriteRule ^(.*)$ http://www.snowcommunity.com/wanaka/$1 [L] Code (markup):
I don't think that this is possible. According to the manual, if you start your substitution string with http:// then an external redirect is forced. So you cannot rewrite to a file on a different domain, you have to redirect to it. If you're doing this I would recommend using a 301 ( permanent ) redirect, as this will prevent potential problems with the search engine spiders.
I don't need to go rewrite to a whole new domain. They are both on the same server. Just not on the same path. I've set up a redirect for now (way too frustrated to keep trying) but I'd still be very interested if anyone knows of a solution to this.
Can you just set the server path for the subdomain to /hsphere/local/home/ccharp/snowcommunity.com/wanaka/ ? Then you probably wouldn't need mod_rewrite at all
I can't do it myself. I've asked my host host once and been denied....I may ask again. That seems like the best/ easiest way. cheers
I know that you want to use mod rewrite but a simple virtual host would do the job just add to /etc/apache2/httpd.conf NameVirtualHost [your IP]:80 <VirtualHost [your IP]:80> ServerName building-a-deck.timesheetsmts.com DocumentRoot [Path of webapp] </VirtualHost> Works on Apache right out of the box
hello to subdomain need wildcard dns enambled in server ! httpd.conf and .htaccess only find files location ! to enamble wildcard dns add * in CNAME in your domain db in /var/named