Membership is FREE, giving all registered users unlimited access to every Acorn Domains feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

catch all with .htaccess

Status
Not open for further replies.
Joined
Jun 16, 2005
Posts
441
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.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Members online

Premium Members

Latest Comments

New Threads

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
  • D AcornBot:
    Darren has left the room.
      D AcornBot: Darren has left the room.
      Top Bottom