I have a URL like www.test.com?id=other-flavor&pid=hannycakes.
I did above URL like www.test.com/other-flavor$pid=hannycakes using .Htaccess
but I need www.test.com/other-flavor/hannycakes.
For this If I use / in my URL it can take as a folder.
How resolve my problem. How to put / in URL?
Try this:
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)$ /?id=$1&pid=$2 [L]
Related
I have a url which is
www.domain.com/index.php?route=ticketsystem/generatetickets
I want people who type in the url www.domain.com/contact to be redirected to the page index.php?route=ticketsystem/generatetickets however have the url bar still show /contact is that possible via htaccess and if so how? I tried the below
RewriteEngine On
RewriteBase /
RewriteRule contact /index.php?route=ticketsystem/generatetickets [L,QSA]
For your shown attempts, please try following .htaccess rules file. Make sure your index.php and .htaccess files are present in same directory/folder. Also better to use & rather than using / for query string.
Make sure to clear your browser cache before testing your URLs.
RewriteEngine ON
RewriteRule ^contact/?$ index.php?route=ticketsystem&generatetickets [QSA,NC,L]
I Want to rewrite the url using .htaccess
Plz Read the code, and you well Get to know What I mean
My URL :
article.php?id=1&title=example
Using this in .htaccess
RewriteRule ^article/([0-9]+)/([0-9a-zA-Z_-]+)$
article.php?id=$1&title=$2 [NC,L]
I get
article/1/example
What i need is
article/example
So something like this:
RewriteRule ^article/([0-9a-zA-Z_-]+)$ article.php?title=$1 [NC,L]
I'd like to rewrite part of URLS like:
http://www.myweb.com/cat1/subcat2/how-to-do-this
to
http://www.myweb.com/cat2/subcat2/how-to-do-this
there are many urls in which the end part(how-to-do-this) changes
I have tried this:
RewriteRule ^cat1/subcat1/(.*) /cat/subcat2 [R=301,L,NC]
but this doesn't works.
Please help.
R=301 is used for external redirection, if you want to rewrite the request , you can use the following :
RewriteRule ^cat1/subcat2/(.*) /cat2/subcat2/$1 [L,NC]
This will internally redirect (without changing the url in browser)
cat1/subcat2/foo
to
cat2/subcat2/foo
How can I rewrite the URL www.example.com/user/xxxx into www.example.com/xxxx using htaccess ?
I tried:
Redirect /user / user/xxx
But, it does not work.
RewriteEngine on
RewriteRule (.*) / user/$1
Hello I have a url that is like that :
www.mysite.com/activation.php?token=d4ba10b14dedc7e7e7338ee8251670fa
What I would like to have is something like that :
www.mysite.com/Activation/Token/d4ba10b14dedc7e7e7338ee8251670fa
How can I do that please
You can put this rule in your htaccess (which has to be in root folder)
RewriteEngine On
RewriteRule ^Activation/Token/([^/]+)$ /activation.php?token=$1 [L]