Redirect domain to a subpage in WordPress

Table of contents
WordPress slow?
We'll sort it out for you!
Redirect cover image domain to subpage
Table of contents

Time and again, we at WPspace Support receive questions about how to redirect an additional domain to a specific subpage of the WordPress website. A standard redirect, for example with a Domain aliasredirects to the homepage of your website by default.

In order to Forwarding to a specific subpage, you only need three lines of code in your .htaccess. In this article, I'll show you step by step how to redirect the domain to a subpage in WordPress in a beginner-friendly guide.

When do I need a redirect to a subpage?

You are planning an event for which you have your own domain and would like to advertise it on a separate subpage of your WordPress website. Then it makes sense to redirect the event domain to the subpage of your WordPress website.

For example:
sommerfest-wpspace.de redirects to wp-space.de/sommerfest

This is particularly practical if you:

  • owns several domains for marketing purposes,
  • want to keep an old domain name,
  • campaign links to landing pages,
  • or want to go directly to a specific page when rebranding.

The solution: Forwarding via .htaccess

The so-called .htaccess-file is a standard file on your WordPress website. It can be used to set up redirects efficiently and permanently.

Example of a forwarding:

In this example, the domain sommerfest-wpspace.de automatically to the underside wp-space.de/summerparty where you can find all the information about the summer festival.

# Begin custom redirects
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?sommerfest-wpspace\.de$ [NC]
RewriteRule ^(.*)$ https://www.wp-space.de/unterseite/ [R=301,L]

If you also want to set up a redirect from a domain to a subpage, you can adapt this line of code to your individual domains. I'll explain step by step below where you need to add this code.

What is happening here technically?

Let us briefly explain the individual lines:

  • RewriteEngine On
    Activates the rewrite function of the Apache web server.
  • RewriteCond %{HTTP_HOST} ^sommerfest-wpspace\.de$ [NC,OR]
    This line checks whether the domain called up is sommerfest-wpspace.de.
    [NC] means "case-insensitive", i.e. case-insensitive.
    [OR] links the condition with the next one using "or".
  • RewriteCond %{HTTP_HOST} ^www\.sommerfest-wpspace\.de$ [NC]
    Checks whether the domain call is made with "www." in front of it.
  • RewriteRule ^(.*)$ https://wp-space.de/sommerfest/ [R=301,L]
    This rule applies if one of the two conditions applies.
    A 301 redirect - this is a permanent redirect - is made to the desired subpage.

Step-by-step instructions

Note 💡: Before you get started, create a backup of your .htaccess. Changes to the .htaccess can cause your website to go down - so please be careful.

1. check host A entries of your domain

In order for your domain to redirect to the subpage of your WordPress website, the two Host A entries (with and without www.) must point to the IP address of your hosting show.

To check this, follow these steps:

  • Make a note of the IP address of your website's hosting plan
  • Call up the website mxtoolbox.com on
  • Enter your website domain in the search bar (without https://)
  • Check whether the IP address in the result matches your noted IP address
Check Host A entry
  • Repeat the process for your www. subdomain
Check host A record for www.

If the two IP addresses matchyou do not need to make any changes.

If the two IP addresses do not matchyou must adjust the IP address of the two Host A entries to the IP address of your website hosting.

2. create as alias

Set the domain that should redirect to your desired subpage in your hosting interface as Domain alias for the main domain of the target website.

3. Open .htaccess

The .htaccess file is located in the root directory of your WordPress website by default. Depending on your host, you have two options for accessing the file:

  • With your FTP access and a program like Filezilla
  • Navigate directly to the root directory via your hosting interface
Open .htaccess

Are you a WPspace customer? Then you can quickly and easily edit your .htaccess in four steps via your WordPress hosting open:

  1. Log in to your hosting interface a
  2. Navigate under "Files"
  3. Select the "httpdocs" folder by default
  4. Click on the .htaccess file

You do not have .htaccess💡: Can't find an .htaccess file in your file directory? Then create a new .htaccess or simply download this standard .htaccess file and then upload it to your root directory: .htaccess Download

4. insert forwarding

  • Open the .htaccess-file
  • Scroll to the end of the file
  • Add the lines of code adapted to your domains after # END WordPress:
# Begin custom redirects
RewriteEngine On
RewriteCond %{HTTP_HOST} ^deinedomain\.de$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www\.deinedomain.de\.de$ [NC]
RewriteRule ^(.*)$ https://domain.de/unterseite [R=301,L]
  • Confirm your changes by clicking Save
Lines of code for forwarding in .htaccess

Note 💡: If you use a program such as Filezilla, you must download the file and edit it locally with a program such as Notepad ++ or Sublime. After you have inserted lines of code, delete the current .htaccess and upload the new .htaccess.

5. perform test

  • Call up your domain, which should redirect to the subpage
  • Are you automatically redirected to the desired subpage? Then you've done everything right

Is your redirect not working? Then I recommend that you contact your hoster's support team with a screenshot of your added lines of code in the .htaccess and ask for help.

What you should consider with redirects

  • 301 instead of 302The 301-forwarding is permanent and is also taken into account by search engines.
  • No forwarding loops: Make sure that you do not redirect the target URL to itself or to a domain that in turn redirects back.
  • Consider HTTPS and WWWCheck whether the target page is accessible with or without "www" and whether it is accessible with SSL (https) - and adjust the RewriteConds if necessary.

Bonus: What if you don't use Apache?

This method only works if your web server Apache is. Does your hoster use NGINXinstead, you need rules in the nginx.conf. You don't know whether your host uses Apache or NGINX? Then simply ask support! 🙂

Conclusion: small change, big effect

With a single forwarding rule in your .htaccess-file, you can direct specific domains to individual subpages of your WordPress website. This is not only practical for SEO and marketing, but also ensures clear structures - especially with multiple domains.

Picture of Isabell Bergmann
Isabell Bergmann
As an online marketing manager at WPspace, I love to share my knowledge around online marketing, web design and hosting.

Links marked with an * are affiliate links. If you buy a product via this link, WPspace receives a small commission. There are no additional costs or disadvantages for you! This has no influence on our opinion of individual products and services - we only recommend what we love ourselves.

Leave a Reply

Your email address will not be published. Required fields are marked *