vignesh
vignesh

Reputation: 21

.htaccess file not found

I got my website done by my friend it is up and running in the public server. I tried to run the same website on my internal server. But apache says file not found. I figured out that the problem is in .htaccess file. This is my file

AddType text/x-component .htc
#BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

and in my apache conf file I set

<VirtualHost *:80>

DocumentRoot /srv/www/
    <Directory />
            Options FollowSymLinks
            AllowOverride All
    </Directory>

    <Directory /srv/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order Deny,Allow
            Deny from all
            Allow from 192.168.43.0/255.255.255.0 192.168.42.0/255.255.255.0
<Directory /srv/www/companies/test1/>
            Options +Indexes +FollowSymLinks +MultiViews
            AllowOverride All
            Order Allow,Deny
            Deny from all
            Allow from 192.168.43.0/255.255.255.0 192.168.42.0/255.255.255.0
    </Directory>
    </Virtualhost>

error log says

[Fri Apr 11 16:57:33 2014] [error] [client 192.168.43.8] File does not exist:/srv/www/cms
[Fri Apr 11 16:57:33 2014] [error] [client 192.168.43.19] File does not exist:/srv/www/products, referer: http://192.168.43.8/companies/

I guess htaccess is lokking for index.php in /srv/www/ folder instead of /srv/www/companies/test1/ folder. Any suggestion how to direct htaccess in correct location?

Upvotes: 2

Views: 7270

Answers (2)

Rupali Malhotra
Rupali Malhotra

Reputation: 11

the .htaccess file is located in the root folder of your instalation and by default is hidden.

If you are using FileZilla:

  1. Start FileZilla then select the "Server" menu at the top
  2. Select "Force showing Hidden Files"

Upvotes: 1

ThatOneDude
ThatOneDude

Reputation: 1526

Assuming you have a cms and product directory in /srv/www/companies/test1/ instead of /src/www/ you could fix the issue by changing your DocumentRoot /srv/www/ to DocumentRoot /srv/www/companies/test1/ and restarting apache.

Generally though, you'd want to set up a custom VirtualHost for each site you are planning on serving and leave the default <VirtualHost *:80> set to whatever should be served by default when you visit your IP address.

See VirtualHost Examples for some examples of common setups.

Upvotes: 1

Related Questions