0
votes

Apache wont load my .htaccess file in my alias directory.

if i put the .htaccess file in my root folder (D:/Development) and project folder (D:/Development/code/project),

http://localhost/filename.html redirects me to stackoverflow.

http://localhost/project/filename.html returns not found 404.

I'm running xampp on windows 7 64 bit.

Why cant i use my .htaccess in my sub directory?

httpd.conf:

<Directory />
    Options +FollowSymLinks
    AllowOverride All
    Order allow,deny
    Deny from all
</Directory>
<Directory "D:/Development">
    Options +Indexes +FollowSymLinks +Includes +ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

httpd-vhosts.conf:

 Alias /project "D:/Development/code/project/"
 <Directory "D:/Development/code/project/">
    Options +FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

.htaccess (redirect is for testing):

redirect 301 /filename.html http://stackoverflow.com
AddDefaultCharset utf-8
RewriteEngine ON
RewriteRule ^(stylesheet|images|favicon) - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^.*$ /index.php [NC,L]
1
Is the index.php file in your document root or in the project directory? - Jon Lin
index.php is in my project directory. But the problem is, my .htaccess is not loaded in my /project directory - jussi

1 Answers

1
votes

Because you have redirect for only the file /filename.html
Replace First line of your code with

redirect 301 filename.html http://stackoverflow.com