.htaccess not working (mod_rewrite)
In my case, I changed in httpd.conf:
toAllowOverride None
and it works.AllowOverride All
.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
Disable Doctrine 2 Lazy Loading When Using Jms Serializer
Mysqli_Store_Result() VS. MySQLi_Use_Result()
How to Check Is Timezone Identifier Valid from Code
Change Mime Type of Output in PHP
Make Script Execution to Unlimited
Upgrading Laravel 5.5 to 5.6 Error
Encoding Byte Data into Digits
Iconv_Strlen Function Causing Execution Timeout, Running on Mamp
How to Call Curl_Setopt with Curlopt_Httpheader Multiple Times to Set Multiple Headers
PHP Require File from Top Directory
How to Get Content of Remote HTML Page
PHP Class Not Found But It's Included
How to Make Ruby Aes-256-Cbc and PHP Mcrypt_Rijndael_128 Play Well Together
Upload Progress Using Pure PHP/Ajax
How to Access Magento Customer's Session from Outside Magento
How to Automatically Read in Calculated Values with PHPexcel