how to make links from:
http://example.com/blog.php?category=1&page=1
to:
http://example.com/news/1/
I try this:
RewriteRule ^news/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ blog.php?cat=$1&page=$2 [NC,L]
but it doesn't work.
Thank you.
Related
Please help me on the RewriteRule below. I want to show the v3.php file for https://example.org/signup.
# Turn Rewrite Engine On
RewriteEngine on
# Rewrite for signup
RewriteRule ^signup v3.php [NC,L]
Works. But all other requests after /signup like /signups or https://example.org/signup/example/whatever show the v3.php as well. I need that RewriteRule only for that exact folder name.
Thanks for your help!
RewriteRule ^signup/?$ v3.php [NC,L]
Thank you, #anubhava
I am in need of a URL rewrite to http://jzbeta.local/category.php?u=new-page&limit=all&page=2&style=new as below,
http://jzbeta.local/new-page&limit=all&page=2&style=new
So far my htaccess file has the following rule:
RewriteRule ^([a-zA-Z0-9\-]+)\/?$ /category.php?u=$1 [NC]
Where I can use only one query string.
Any help is greatly appreciated.
UPDATE
Once i changed existing rewrite as following, it worked as i expected.
RewriteRule ^([a-zA-Z0-9\-]+)\/?$ /category.php?u=$1 **[L,QSA]**
Thanks for the suggestions.
You can use the following rule :
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /category.php?u=$1&limit=$2&page=$3&style=$4 [NC,L]
I have the following htaccess rules but I dont know how to make it work:
RewriteEngine on
RewriteRule ^game/([^/]*)$ index.php?cash=$1
The following is the screen shot of my folders structure:
Can someone tell me how to get it to work? I have also tried:
RewriteRule ^index.php([^/]*)$ index.php?cash=$1
The URL that I want to display is: http://localhost/biteep/game/100 while the URL that I want the browser to go to is http://localhost/biteep/game?cash=100
Try to put a rewrite base into your .htaccess:
RewriteBase /biteep/
And this route should be enough:
RewriteRule ^game\/(\d+)$ index.php?cash=$1
So it works when I do this
RewriteEngine on
RewriteRule ^([0-9]+)$ index.php?cash=$1
I am completely nube with htaccess rewriting. Today I am stuck with a problem..
I want my url www.try.com/formal-shoes.php?catId=2 to show as www.try.com/second
second one www.try.com/formal-shoes.php?catId=1 to show as www.try.com/first Like this. Please help me to do so. what shall be rule...
As by hit and trial I wrote
<IfModule mod_rewrite.c>
RewriteRule formal-shoes.php?catId=2 second/$1 [R=301,L]
</IfModule>
You are looking at this the wrong way! Your rewrite rule should be like:
RewriteEngine on
RewriteRule ^/second$ index.php?catId=2 [QSA,L]
RewriteRule ^/first$ index.php?catId=1 [QSA,L]
Note: We are rewriting the expected url to the actual url. Also, RewriteEngine on is mandatory!
PS. Its Noob not nube :)
Im trying to transfrom link like this:
http://localhost/photohosting/user/view.php?img=60
Into something like that in users browser:
http://localhost/photohosting/60
Here my code for .htacces
RewriteEngine on
RewriteRule ^view.php(.*)$ /photohosting/user/view.php?img=$1 [L,QSA]
I'm not familiar with .htaccess so I can't found the mistake. Why this code doesn't work?
UPDATE: I've updated my .htaccess to:
RewriteRule ^([a-zA-Z0-9_-]+)$ user/view.php?img=$1 and now link like http://localhost/photohosting/60 works, but it misses param.
Try with the following rule:
RewriteRule photohosting/([0-9]+)$ /photohosting/user/view.php?img=$1 [L,QSA]