Forum Moderators: phranque

Message Too Old, No Replies

htaccess redirect all subdomains and pages to index problem

htaccess redirect subdomain problem

         

digib

8:51 pm on Jan 20, 2012 (gmt 0)

10+ Year Member



Hello. This might not technically be a programming issue but I did not know where else to put this.

I have a typo domain where I want every single wildcard subdomain and every single page (in subdomain and in main folder) to redirect to mydomain.com/index.htm

I have followed the instructions here [easymodrewrite.com...] and elsewhere, which means that:

1. I have added *.mydomain.com. to the nameserver.
2. The host has added a ServerAlias according to instructions(server runs litespeed, not apache)
3. I have added .htaccess files as shown in the example url above

I have managed to get all wildcard subdomains to redirect to index.htm , but subdomain.mydomain.com/mypage.htm gives a 404, this is without .htaccess in place in the root. When I put .htaccess in place, I get a "You don't have permission to access / on this server."

Any ideas on how to proceed with this? I am wondering if the issue is related to the ServerAlias or the htaccess, finding it hard to narrow it down.

Appreciate of any help or ideas you can give me.

g1smd

9:12 pm on Jan 20, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



One thing. You should never redirect to a named index page. The canonical URL ends with a trailing slash.

lucy24

9:38 pm on Jan 20, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



When I put .htaccess in place, I get a "You don't have permission to access / on this server."

This can't be happening by the mere presence or absence of an .htaccess file. Unless you're saying that it happens even if you put in a perfectly blank page and call it .htaccess. Which would be unnerving. What's in the htaccess? Don't perfectly understand why it has any effect at all if server isn't running apache in the first place, but someone else will explain that.

digib

12:13 am on Jan 24, 2012 (gmt 0)

10+ Year Member



Thank you lucy24 and g1smd. SOME of my problems were related due to a very slow propagation from my old hosting. Now the wildcard subdomains redirect to index, but not the individual pages on the subdomains. Now the only problem left is the .htaccess file. What should a htaccess file look like that:

1. Redirects all wildcarddomain.example.com/randompage.htm to example.com/index.htm
2. Redirects all example.com/randompage.htm to example.com/index.htm

I would try to puzzle it together myself but this htaccess regex stuff really gives me a headache. I am not enough geek to fully grok this stuff.