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.

Quick htaccess redirect question

Status
Not open for further replies.
Joined
Apr 16, 2007
Posts
1,478
Reaction score
24
RewriteCond %{HTTP_HOST} ^domain.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.co.uk$
RewriteRule ^/?$ "\/domain\.php" [R=301,L]

What would I need to add to the above to forward domain.co.uk/anything to domain.php?

Thanks for your time.

- Rob
 
RewriteCond %{HTTP_HOST} ^domain.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.co.uk$
RewriteRule ^/?$ "\/domain\.php" [R=301,L]

What would I need to add to the above to forward domain.co.uk/anything to domain.php?

Thanks for your time.

- Rob

Try:

Code:
RewriteCond %{HTTP_HOST} ^domain.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.co.uk$
RewriteRule ^ /domain.php [R=301,L]
 
Try:

Code:
RewriteCond %{HTTP_HOST} ^domain.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.co.uk$
RewriteRule ^ /domain.php [R=301,L]


Thanks Dave, however that doesn't appear to work...

---
The page isn't redirecting properly

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

---

The clarify what I'm trying to do...

At the moment I have quite a few domains parked with my hosting account and redirected to personalised landers...

e.g. connexity.co.uk redirects to /connexity.php

The problem is that if I tack /index.htm on to the end of connexity.co.uk, it redirects to my main domain index page, which is causing indexing problems in google.

I was hoping there would be a way for me wildcard any /whateverfile traffic to the correct connexity.php page?

Thanks,
- Rob
 
use:
RewriteRule ^(.*)$ domain.php?val=$1 [L]

you can pick up the val variable to do some conditional processing if you need.
if not just remove the ?val=$1 from above and it will still work
 
use:
RewriteRule ^(.*)$ domain.php?val=$1 [L]

you can pick up the val variable to do some conditional processing if you need.
if not just remove the ?val=$1 from above and it will still work

That doesn't appear to work for me, unless I'm compiling the code incorrectly.

- Rob
 
Is there a reason you need connexity.php?

Why couldn't you just use www.connexity.co.uk and map everything through index without any .php file would be much cleaner and google would prefer

The landers use a lot of php includes, which I like because I can make changes across all landers in one shot. To be honest, would be a pain to change things now. Google doesn't appear to mind so far (well over a year). Most of the domains that resolve to these landers rank fairly well.

It is however causing problems for the reasons outlined above. This is a recent problem by the way. Google handled things just fine until a week or so ago.

- Rob
 
Last edited:
Status
Not open for further replies.

Rule #1: Be Respectful

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

Members online

No members online now.

Premium Members

New Threads

Domain Forum Friends

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