0

I have a wordpress website server running on linux. I have a issues when I enter docs.domain.com it opens a Test Page Test Page pic . So my target is when users enter https://docs.example.com to redirect them to https://example.com/example-documentation/ , can you help me ? Best Regards

    [example conf.d]$ cat docs.conf
<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName docs.example.com
    ServerAlias docs.example.com
    DocumentRoot /var/www/brand/Documentation/new


RewriteEngine on
RewriteCond %{SERVER_NAME} =docs.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
7
  • What have you tried? Have you googled redirect apache? Have you read Apache documentation, which frankly is excellent?
    – vidarlo
    Oct 25 at 10:35
  • Yes, but I do not have a test environment :) I am a little bit coward to test the things on the production. I think iif I add this rule RewriteCond %{SERVER_NAME} ^docs\.example\.com$ [NC] RewriteRule ^(.*)$ example.com/example-documentation/$1 [L,R=301] Will do the things ?
    – AZAZEL
    Oct 25 at 10:38
  • Or if I modify the docs.conf file and add a "Redirect 301 /example-documentation docs.example.com" ?
    – AZAZEL
    Oct 25 at 10:45
  • <IfModule alias_module> # # Redirect: Allows you to tell clients about documents that used to # exist in your server's namespace, but do not anymore. The client # will make a new request for the document at its new location. # Example: # Redirect permanent /foo example.com/bar What if I modify the httpd.conf and add Redirect permanent /example-documentation docs.example.com ?
    – AZAZEL
    Oct 25 at 10:51
  • Good chance to set up a test environment then. VirtualBox is free of charge, and allows you to spin up a VM with Apache.
    – vidarlo
    Oct 25 at 11:02

0

You must log in to answer this question.

Browse other questions tagged .