Redirect/Forward website, but not images?

danmumford.com

Hello, I am trying to set my domain name (danmumford.com) to redirect to a social media link sharing site, I had the redirect set up ok, but then I realised it is also redirecting any image links as well, what do I need to change/set up so it only redirects the main domain?

Thanks, Dan

If you are redirecting your main domain to a certain URL, then every URL on your website will redirect to that certain URL.

If you only want your main page to redirect to a certain URL, then the Redirects tool is not the tool to use. Instead, you can setup an index.php file in your htdocs directory which does a PHP redirect to the desired page:

Setting it up like this (after removing the redirect from the Redirects tool of course), will only redirect the main page.

4 Likes

I think I may have figured it out by removing the A records from namecheap (where my domain is) and adding a .htaccess file in htdocs that says the following…

Blockquote RewriteEngine On
RewriteCond %{REQUEST_URI} !^/images/
RewriteRule ^(.*)$ https://beacons.ai/danmumford/$1 [R=301,L]

Ok…maybe not, it was working and now it suddenly isn’t. :expressionless:

Why don’t you do this instead, it is much easier…

6 Likes

If I redirect using index.php should I still remove the a records from Namecheap?

If you are referring to the A records pointing your domain to our hosting, then you should definitely not delete them. If you do, then all URLs on http://danmumford.com will stop working and return a DNS lookup error instead. You will have no way to serve images or redirects on a domain name that’s not pointing to a web server.

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.