Membership is FREE – with unlimited access to all features, tools, and discussions. Premium accounts get benefits like banner ads and newsletter exposure. ✅ Signature links are now free for all. 🚫 No AI-generated (LLM) posts allowed. Share your own thoughts and experience — accounts may be terminated for violations.

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.

Rule #1: Be Respectful

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

Premium Members

New Threads

Domain Forum Friends

Lastest Listings

Our Mods' Businesses

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