Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9234905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:54:00+00:00 2026-06-18T06:54:00+00:00

If I put theese lines to .htaccess everything works well (when I’m going to

  • 0

If I put theese lines to .htaccess everything works well (when I’m going to http://www.example.ru I’m redirected to http://example.ru).

RewriteEngine On

# Installation directory
RewriteBase /

# Redirect all www to non-www
RewriteCond %{HTTP_HOST} ^www.example.ru [NC]
RewriteRule ^(.*)$ http://example.ru/$1 [L,R]

But If I put exactly same lines to <VirtualHost> -> <Directory> section trying to go to http://www.example.ru redirects me to http://example.ru/www.

Anybody knows why?

UPD

New VirtualHost:

<VirtualHost *:80>
    ServerName example.ru
    ServerAlias www.example.ru
    ServerAdmin webmaster@localhost
    DocumentRoot /home/example/www/example.ru/www

    RewriteEngine On

    <Directory /home/example/www/example.ru>
            Options FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog /home/example/www/example.ru/log/error.log

    LogLevel warn

    SetEnvIf Remote_Addr 127.0.0.1 loopback

    CustomLog /home/example/www/example.ru/log/access.log combined env=!loopback

    # Redirect all www to non-www
    RewriteCond %{HTTP_HOST} ^www.example.ru [NC]
    RewriteRule ^(.*)$ http://example.ru$1 [L,R]

</VirtualHost>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:54:01+00:00Added an answer on June 18, 2026 at 6:54 am

    Spent some time I’ve figured out, that in VirtualHost section, pattern will match against the part of the URL after the hostname and port, and before the query string (in my case “/”).

    In Directory section, pattern will match against the filesystem path.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I put these lines in the xxxAppDelegate.m file, it works fine. But I
Put together an extremely simple Knockout.js exmaple to learn how it works. I immediately
I have try to put these 2 lines php_value post_max_size 30M php_value upload_max_filesize 30M
I have put these two lines in my Findglm.cmake file to point to the
I put lock on a few lines which are supposed to get cookie files
I put these lines of code in my functions.php if(function_exist(showMessage)){ showMessage(); } but it
Take for example a short file consisting of these lines: Apple = 1 Pear
I've got a VirtualHost directive in /etc/apache2/openpanel.d/www.example.com.conf : <VirtualHost *:80> ServerAdmin jon@example.com DocumentRoot /home/openpanel-admin/sites/www.example.com/public_html
I have a text (with several lines) that I need to put in a
Within c#, i can put data to seperate strings. For example the current date

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.