please help me to fix error on my .htaccess it return error 500
Options -MultiViews
RewriteEngine On
RewriteBase /mvc/public
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?url=$1 [SQA,L]
The problem is with your flag in the RewriteRule. SQA is not a valid flag, but I'm assuming you meant QSA, so change SQA,L to QSA,L:
RewriteRule ^(.+)$ index.php?url=$1 [SQA,L]
Related
i am getting a 404 error when a dot comes in my url, for example: http://example.com/Samsung-Galaxy-Mega-5.8
here my entire htaccess code:
RewriteEngine on
Options -Indexes
#RewriteCond %{HTTP_HOST} ^([a-z0-9-A-Z_]*).([a-z]*)$
#RewriteRule ^(.*)$ http://www.%1.%2/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^([a-zA-Z0-9_-]+)$ show_mobile.php?bid=$1&brandname=$2
RewriteRule ^([a-zA-Z0-9\-]+)-([a-zA-Z0-9\-]+)$ show_mobile.php?bid=$2&brandname=$1
kindly help me i have searched many questions but i didn't get any helpful which works properly.
Tweak your regex to allow DOT after first hyphen:
Options -Indexes
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9-]+)-([\w.-]+)/?$ show_mobile.php?bid=$2&brandname=$1 [L,QSA]
I have this htaccess file:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
DirectoryIndex index.php
RewriteRule ^doit$ doit.php [L]
RewriteRule ^([\$\.A-Za-z0-9_-]+)$ follow.php?follow=$1 [QSA,L]
But when i try to go in the index page, everytime showing follow.php page, even doit page show this last one.
Any fix for this issue please ?
Thank's.
RewriteCond technically applies only to the first RewriteRule, so
please try using something like this:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^([\$\.A-Za-z0-9_-]+)$ follow.php?follow=$1 [QSA,L]
#RewriteConds for this rule
RewriteRule ^doit$ doit.php [L]
DirectoryIndex index.php
I hope be useful. Regards.
this is my htaccess:
Options All -Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^home index.php
RewriteRule ^register register.php
RewriteRule ^rules rules.php [L]
When i add fourth rule to htaccess it returns 500 error.
so htaccess is allowing only 3 rewrite rules?
First thing is when you receive an error you should always check your Apache error_log file. It will give you the specific reason for the error. We would only be guessing at what your problem might be.
Now this might not be "the" issue however the RewriteCond only works for the RewriteRule directly following it. You can't use the same condtions for all of your rules. You should also get in to the habit of using the [L] flag on the rules to prevent it from reading the next rule once it has matched.
Options All -Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^home/?$ index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^register/?$ register.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^rules/?$ rules.php [L]
I use these type of URL:
http://test.com/rest/api.php?action=test
But I need these type URL:
http://test.com/rest/api/action/test
I try to .htaccess file these code here
RewriteEngine On
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]
Put this code by relacing your code your .htaccess under DOCUMENT_ROOT/rest directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /rest/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^api/([^/]+)/?$ api.php?action=$1 [QSA,NC,L]
This should fix it:
RewriteEngine On
RewriteRule ^rest/api.php?action=test$ /rest/api/action/test [L]
Your goal can be achieved by using regular expressions with syntax like :
RewriteRule ^rest/api/action/(\d+)*$ ./rest/api.php?action=$1
try read these articles :
http://net.tutsplus.com/tutorials/other/using-htaccess-files-for-pretty-urls/ and
http://net.tutsplus.com/tutorials/other/the-ultimate-guide-to-htaccess-files/
So I want to send three variables (separated by slashes) to my index.php but I can't get it working, I'm a leek with htaccess.
My base url is localhost:8888/smbo/
And I have this code which does not work:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /smbo/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)$ index.php?id=$1&idTwo=$2&idThree=$3
</IfModule>
Who can help me?
Try this code :
RewriteEngine On
RewriteBase /smbo/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/([^/]+)$ /index.php?id=$1&idTwo=$2&idThree=$3