0

I am running ubuntu 14.04 with apache 2.4.x. I created virtual host mydomain.local. All my website works perfectly on local machine except home page i.e. http://mydomain.local/

I can run anything like http://mydomain.local/dir-name or http://mydomain.local/file.name. In short all URLs are working fine which have something at tail.

Here is my directory structure:

/var/www/html/site_name/public
     .htaccess
     wp/index.php
     index.php


Following is my .htaccess code:

# Base is the URL path of the home directory
RewriteBase /
RewriteRule ^$ wp/index.php [L]

# Skip real files and directories
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Otherwise send it to WordPress
RewriteRule .* wp/index.php [L]


Virtualhost config file:

<VirtualHost *:80>
    ServerName mydomain.local

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/site_name/public

        <Directory /var/www/html/site_name/public>
                Options +FollowSymLinks
                Options +Indexes
                AllowOverride all
                Require all granted
                Order allow,deny
                Allow from all
        </Directory>


    ErrorLog ${APACHE_LOG_DIR}/site_name_local_error.log
    CustomLog ${APACHE_LOG_DIR}/site_name_local_access.log combined

</VirtualHost>

All my URLs redirect to /wp/index.php. Only home http://mydomain.local/ page is not rewriting.

http://mydomain.local/ is not rendering main index.php instead of wp/index.php

Note: Same code and htaccess configuration working on ubuntu 16.04.

  • What does the error and access logs show? – vidarlo May 17 '18 at 13:32
  • @vidarlo No error there. It loads main index.php. But according to rule it should render wp/index.php – Parixit May 17 '18 at 13:37
  • @Parixit put in your current virtual host file LogLevel alert rewrite:trace6 and you will get logging ;) source httpd.apache.org/docs/2.4/mod/mod_rewrite.html#logging – Rinzwind May 17 '18 at 15:06
  • @Rinzwind Sure, I will put it and check. – Parixit May 18 '18 at 4:48

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.