i done url rewrite below in .htaccess
RewriteEngine On
RewriteBase /
RewriteRule ^admin/(.*) Rrrrr/core-.php [L]
RewriteRule (.*) Rrrrr/core.php [L]
All the files in admin folder should rewrite into core-.php
And all other files should rewrite into core.php
But all the files are rewriting into the core.php only.
http://www.konasignature.com/shop/women/dresses - this url working as per second command rule
But http://www.konasignature.com/admin/ - not working. 404 page only
This code works for me !
RewriteEngine on
RewriteRule ^admin/(.*) login/core-$1 [L]
Please use $ for this command
RewriteEngine On
RewriteBase /
RewriteRule ^admin/(.*)$ Rrrrr/core-.php [L]
RewriteRule (.*) Rrrrr/core.php [L]
Related
I have a website www.example.com/blog/abc. I need it to redirect to www.example.com/blog/a.php?a=abc
Below is my .htaccess file
RewriteEngine On
RewriteBase /
RewriteRule ^blog/(.*)$ blog/a.php?a=$1 [R=301,L]
What am i doing wrong ?
Try:
RewriteRule ^blog/(.*)/?$ blog/a.php?a=$1
Instead of:
RewriteRule ^blog/(.*)$ blog/a.php?a=$1
I have htaccess file and this is in it:
RewriteEngine On
Options +FollowSymlinks
RewriteBase /project/
RewriteRule ^betNow/$ index.php?action=betNow [L]
RewriteRule ^(.*)/betNow/$ index.php?action=betNow [L]
RewriteRule ^(.*)/betNow/([0-9]+)$ index.php?action=betNow&id=$2 [L]
and it works, when I type localhost/project/betNow/
but I can't figure out last rule
I tried with localhost/project/betNow/4
and localhost/project/betNow/id=4
and that's not working. what am I doing wrong?
Thanks in advance
You have defined your RewriteBase /project/ and your site apparently resides in http://localhost/project/ - so when you call http://localhost/project/betNow/ the request string handed over to the rewrite rules is just betNow/.
Therefor your rules starting with ^(.*)/betNow will not match. You just need:
RewriteRule ^betNow/$ index.php?action=betNow [L]
RewriteRule ^betNow/([0-9]+)$ index.php?action=betNow&id=$2 [L]
And you can use
http://localhost/project/betNow/ --> index.php?action=betNow
http://localhost/project/betNow/4 --> index.php?action=betNow&id=4
Shouldn't the rules be
RewriteEngine On
Options +FollowSymlinks
RewriteBase /project/
RewriteRule ^betNow/$ index.php?action=betNow [L]
RewriteRule ^betNow/([0-9]+)$ index.php?action=betNow&id=$2 [L]
You may need to put a / after both of the ^ characters in the rewrite rules too
Instead of localhost/project/betNow/id=4 try: localhost/project/betNow/id/4
And use:
RewriteRule ^(.*)/betNow/id/([0-9]+)$ index.php?action=betNow&id=$2 [L]
I have strange for me problem. I'm developing Zend Framework application and have this file structure:
/
/application/
/public/
/public/.htaccess
/public/index.php
/public/js/
/public/style/
/public/profile/
/.htaccess
My domain point to folder /
When I enter the address example.com/profile/ it goes to the controller profile and this is good.
When I enter the address example.com/profile the server redirects me to:
example.com/public/profile/
I would like to have a solution that whenever I request:
example.com/profile/ or
example.com/profile
The same page will be rendered but second version gives me a redirect and I don't know why.
The /.htaccess file is:
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
The role of this file is to route all traffic from / to /public but without any redirects.
The /public/.htaccess file is:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
Can anybody help me with this? Thanks.
I fixed this. Here is the solution if somebody have the same problem:
To fix this you have to set the following options and disable DirectorySlash
Options -Indexes FollowSymLinks
DirectorySlash Off
Now Apache shouldn't add trailing slashes at the end of uri when you pointing to directory.
This also disable redirect to the uri with trailing slash.
Optionally match the last /. Change your .htaccess file to this:
RewriteEngine On
RewriteRule ^(.*)/?$ public/$1 [L]
This works for me:
RewriteEngine On
RewriteRule ^/$|^(.*)$ /public/$1 [QSA,NC,L]
I need a rewrite rule to rewrite the following:
www.abc.com/page/xyz to www.abc.com/xyz
remove **"page"** from url
I think it's more like this:
RewriteBase /
RewriteRule ^(.*)$ page/$1 [L]
If I understand what you're trying to do.
Like so:
RewriteBase /
RewriteRule ^page(/.*)?$ $1 [L]
If you only want to redirect page/xyz then you can use:
RewriteEngine on
RewriteRule ^/page/xyz$ /xyz [L]
If you want to redirect anything within the page directory, then use:
RewriteEngine on
RewriteRule ^/page(/.*$)$ $1 [L]
I'm try to rewrite my url
http://www.domain.com/live/randomword
it should go rewrite to
http://www.domain.com/live/?cat=randomword
here are my tests:
RewriteRule ^live/(.*)$ /live/?cat=$1
RewriteRule ^live/(.*)$ live/?cat=$1
and all i have in the htaccess file is:
RewriteEngine on
You should try to add a RewriteBase / to your .htaccess and to suffix your rule with a [L] to say it's last rewrite rule ending with something like that:
RewriteEngine on
RewriteBase /
RewriteRule ^live/(.*)$ live/index.php?cat=$1 [L]
If this still doesn't work be sure to check that mod_rewrite is enabled
also you can do a [R,L] instead of [L] to see the redirection in the url and so have more info on what's going own.
hope this help
Have this code in your .htaccess file:
Options -MultiViews +FollowSymLinks
RewriteEngine On
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^live/(.*)$ /live/?cat=$1 [L,NC]
in rewrite rule the file name or extension in missing?
write rule like,
RewriteRule ^live/([a-zA-Z0-9_-]+)$ /viewcategory.php?cat=$1