• Welcome to AcornDomains.co.uk, a friendly community for UK domain investors, developers and anyone interested in domain names.

    Whether you're looking to buy or sell domains, learn more about the UK domain market, get feedback on your names, or simply chat with other domainers, you're in the right place. AcornDomains has been bringing together people from across the UK domain industry for many years, from complete beginners to experienced investors.

    Have a look around, join the discussions and, if you haven't already, create a free account and introduce yourself.

catch all with .htaccess

Status
Not open for further replies.
Joined
Jun 16, 2005
Posts
440
Reaction score
9
hi folks.. looking for help with .htaccess file

i've got a few domains that had hundreds of sub domains in a previous life.. does anyone have an example of .htaccess that will do a catch all with a perm 301 redirect?

i want to catch any traffic from "anysub.domain.com" and any "domain.com/any/dir/and/file"

cheers steve

hosting is Linux & Cpanel
 
This probably isn't a .htaccess problem it's a DNS problem you (or your web host if it's not your server) need to edit the httpd.conf to add lines of the form:

ServerAlias *.example.co.uk

If you've already got subdomains in the httpd.conf redirecting to directories, then .htaccess files within them can redirect to your main site.

For the other bit you just need something like
Code:
RewriteRule ^(.*)$ index.html

Which will redirect all requests to index.html
 
This probably isn't a .htaccess problem it's a DNS problem you (or your web host if it's not your server) need to edit the httpd.conf to add lines of the form:

ServerAlias *.example.co.uk

If you've already got subdomains in the httpd.conf redirecting to directories, then .htaccess files within them can redirect to your main site.

For the other bit you just need something like
Code:
RewriteRule ^(.*)$ index.html

Which will redirect all requests to index.html

cheers! ;) excuse my ignorance, could I edit the zone files in whm & accomplish the same thing?... i'd quite happily vi the httpd.conf file if I could access it directly..

thanks!
 
No.

But you might have to edit the zone file as well, if there's not already a line like:

*.example.co.uk. 14400 IN A xxx.xxx.xxx.xxx

Note the trailing '.' after the uk

Then you'll need one.
 
No.

But you might have to edit the zone file as well, if there's not already a line like:

*.example.co.uk. 14400 IN A xxx.xxx.xxx.xxx

Note the trailing '.' after the uk

Then you'll need one.

cheers matey! appreciate your help...
 
Status
Not open for further replies.
Top Bottom