Error with .Htaccess and Mod_Rewrite

.htaccess not working (mod_rewrite)

In my case, I changed in httpd.conf:

AllowOverride None

to

AllowOverride All

and it works.

.htaccess Rewrite Rule Error

Okay Now I have the answer actually there should be a slash here ..

RewriteRule ^login$ /login.php

This just solved my problem ...

XAMPP mod_rewrite object not found error

You should disable MultiViews option, which is enabled by default most of the time (see this post and my answer on this topic)

Here is how your /shop/.htaccess file should look like:

Options -MultiViews

RewriteEngine On
RewriteBase /shop/

RewriteRule ^category/([^/]+)$ categories.php?cat=$1 [L,NE]

Internal Server Error with mod_rewrite and RewriteRule

You are getting 500 error because *. is an invalid regex that cannot be compiled. Moreover you need to skip files/directories from your last rewrite rule.

Options -MultiViews
RewriteEngine On
RewriteBase /

# Interpret "work/(ARG)" as "work/item.php?id=(ARG)"
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^work/([\w-]+)/?$ work/item.php?id=$1 [L,QSA,NC]

RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]

rewrite problems (htaccess)

I am on mobile I haven't tested it but looks like you could be reaching out to maximum redirect limits here why because your condition in your root htaccess isn't looking good to me, try this once.

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteCond %{REQUEST_URI} !^/public/? [NC]
RewriteRule (.*) public/$1 [L]
</IfModule>

Issues in OP's approach: You haven't mentioned any condition to when it should redirect so it doesn't know when to stop hence it's creating a loop here IMHO.

Apache 2.4.10 with mod_rewrite returns '404 Not Found'

You're missing a RewriteBase directive.

Since your .htaccess file is in your /ws/rest/ directory and this path is part of your url you could use /ws/rest/ as the RewiteBase.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /ws/rest/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^(.*)$ api.php?rquest=$1 [QSA,NC,L]

RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ api.php [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} -s
RewriteRule ^(.*)$ api.php [QSA,NC,L]
</IfModule>

RewriteBase documentation

apache mod_rewrite not working with .htaccess file

Not sure if this is the cause of your problems, but you shouldn't mess with the

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

line, and it should be something like:

<Directory />
Options FollowSymLinks
AllowOverride None
Deny from all
</Directory>

You should add the directory of your document root as a different container:

<Directory /var/www/html/>
Options FollowSymLinks
AllowOverride All
Allow from all
</Directory>


Related Topics



Leave a reply



Submit