Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

160
Views
Apache2 doesnt redirect non-www to www

I have a apache2 serving an application which works fine on www.domain.co.uk but when going to domain.co.uk (non www) it doesn't redirect the traffic. I added a redirect to my .conf file and it still doesn't work. See below:

<VirtualHost *:80>
    ServerName domain.co.uk
    Redirect permanent / http://www.domain.co.uk/
</VirtualHost>
<VirtualHost *:80>
    ServerName www.domain.co.uk
    ServerAlias domain.co.uk
    # Actual server configuration
</VirtualHost>

Does anyone know how to redirect the non-www traffic to www (or fix my configuration!)?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You have two separate areas of the configuration capturing domain.co.uk - one is in the redirection, the other (through your use of ServerAlias) in the configuration that serves the content. The second capture is overriding the first.

To resolve the issue, simply remove the line:

ServerAlias domain.co.uk

and restart Apache.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!