Member Avatar for Member #858389

Hi
I have a client for which I have built a site however they have an old domain which is being forwarded to the new domain. However there are listings for the old domain which contained pages which do not exist on the new site so page not found errors are occuring quite frequently. Is there any way I can point all these old page listing to the new site home page?

Kind regards
Julie

Dani AI

Generated

reported old .asp URLs landing on a new Drupal site and causing 404s. As pointed out, a server-side 301 is preferable to registrar/frame forwarding — but a blanket redirect of every old URL straight to the new homepage is a last-resort choice because it’s poor for search engines and user experience.

Best practice

  • Prefer one-to-one 301 redirects from an old URL to the closest new page. That preserves SEO value.
  • If an exact match does not exist, allow a proper 404/410 or serve a helpful custom 404 with search/navigation rather than silently pushing everything to the homepage.
  • Where hosting for the old domain is available, add rules in the old domain’s Apache .htaccess (place these before Drupal’s rewrite block).

Example .htaccess patterns (replace old-domain.com and new-domain.com with the actual hostnames):

RewriteEngine On

# targeted redirect (preferred for mapped pages)
Redirect 301 /oldpage.asp https://new-domain.com/new-path

# redirect only .asp requests from the old host to homepage
RewriteCond %{HTTP_HOST} ^(?:www\.)?old-domain\.com$ [NC]
RewriteCond %{REQUEST_URI} \.asp$ [NC]
RewriteRule ^ https://new-domain.com/ [R=301,L]

# catch-all for entire old host -> homepage (least preferred)
RewriteCond %{HTTP_HOST} ^(?:www\.)?old-domain\.com$ [NC]
RewriteRule ^ https://new-domain.com/ [R=301,L]

Practical notes

  • Put the rules at the top of the old domain’s .htaccess so they run before Drupal’s rules. Confirm no redirect loop by matching the HTTP_HOST to the old domain only.
  • If the old domain is only redirected at the registrar and no hosting is available, ask the registrar for a server-side 301 (not a framed/302 redirect) or host the old domain and implement the .htaccess there.
  • Test with curl -I http://old-domain.com/somepage.asp to confirm an HTTP/1.1 301 and the Location header. Monitor Google Search Console and update the sitemap to help search engines reindex. For IIS hosts, use the URL Rewrite module as mentioned.

Recommended Answers

All 3 Replies

Yes... many of the web host providers offer this type of redirection in their hosting package. However, this approach is not very SEO friendly. Their page ranks for each URL indexed will begin to go down. Its not usually the recommended approach, but if it is the only option, it is better than showing the user (or a search engine crawler) a 404 error.

For a more fine tuned redirection...for php, you would use .htaccess, and for asp.net, the URLRewrite module.

Member Avatar for Member #858389

Thanks for the reply, the pages that are giving me an errors are asp pages like

page not found
    


The new site that I am running uses Drupal so what changes to the .htaccess file would I need to make to ensure these are redirected to the home page of my site?

Sorry, i have experience with IIS/URLRewriteModule. I am confident that someone else in this forum will be able to advise on rule writing in .htaccess.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.