- Joined
- Dec 10, 2007
- Messages
- 9,144
- Likes received
- 627
- Thanks received
- 182
- Location
- In the pub
I would avoid using .htaccess files if I were you. Much safer to use CNAME records.
Humm I thought I had to do both.
I tried creating a CNAME record like this:
Code:
www.subdomain.example.com subdomain.example.com
I tried creating an A record like this:
Code:
www.example.com 99.99.99.99
subdomain.example.com 99.99.99.99
www.subdomain.example.com 99.99.99.99
Then in .htaccess I have this
Code:
RewriteCond %{HTTP_HOST} ^www.subdomain.example.com
RewriteRule ^(.*) [url]http://subdomain.example.com[/url] [R=301,L]
Ah but which .htaccess I hear you ask. On the web server when I FTP in, I see this structure:
a file called .htaccess (this is the one where I have added the rewrite stuff)
a folder called www
a folder called subdomain
a folder called cgi-bin
In the subdomain folder there is a standard wordpress .htaccess file to whoch I have added so now it looks like this:
Code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.subdomain.example.com
RewriteRule ^(.*) http://subdomain.example.com [L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
But without access to the Apache logs I can't get any insight as to how far it's getting before failing.
EDIT: added code tags to stop forum software mangling my post
Last edited:
15:27

