AlexHeuman
AlexHeuman

Reputation: 1006

.htaccess files not working on apache

/etc/apache2/sites-available/default.conf reads:

<Directory>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
</Directory>

I have mod_rewrite enabled

Under /var/www/sitename I have my .htaccess file which reads:

RewriteEngine On

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

Yet, when access localhost/sitename/directory I get a 404 error

What am I missing here?

Upvotes: 0

Views: 3359

Answers (3)

user4287361
user4287361

Reputation: 1

try this -

Options +FollowSymLinks
RewriteEngine on
RewriteRule process-id-(.*)\.htm$ process.php?id=$1 

Upvotes: 0

CodeReaper
CodeReaper

Reputation: 6145

For people using ubuntu I found this answer to be complete.

https://askubuntu.com/a/48363

Upvotes: 0

Tom Irons
Tom Irons

Reputation: 33

Try adding RewriteRule ^(directory)($|/) - [L] above the first RewriteCond so it will exclude the directory from RewriteRule you can add more than 1 directory by seperating them with | like RewriteRule ^(forum|extras)($|/) - [L]

Here is an example:

RewriteEngine On
RewriteBase /

RewriteRule ^(directory)($|/) - [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l 

Upvotes: 0

Related Questions