htaccess rewrite logout url - .htaccess

I have a url like this
http://example.com/wp-login.php?action=logout&_wpnonce=ab720d18d2
Can someone help me to rewrite like this
http://example.com/logout/ab720d18d2
Thanks

We are here to answer question. Not to write code for you.
But because it is almost christmas:
RewriteRule ^logout/(.*) /wp-login.php?action=logout&_wpnonce=$1

Related

How do you write a htaccess redirect for pages which look like they're directories?

I'm trying to figure out how to do a 301 redirect for a page who's URL is in the format
www.site.co.uk/foo/bar/
to a URL formatted as
www.site.co.uk/bar.html
I've tried using Redirect which didn't work and I've tried RewriteRule as well but I've not been having much luck.
Could anyone offer some help or link me to some great htaccess tutorials?
Any help would be greatly appreciated.
I've found the solution by reading:
http://perishablepress.com/redirect-subdirectory-to-root-via-htaccess/
The htaccess code is as follows:
RedirectMatch 301 ^/foo/bar/$ http://www.site.co.uk/bar.html

.htaccess for cakephp

I am runing a site wishberry.in on cakephp framework. I had some dirty URLs previously and now i want them to cleanup through .htaccess
I original url was wishberry.in/createwishlist3 and i want to change that to wishberry.in/brands with a 301 redirect.
The reason for using 301 is, if someone type wishberry.in/createwishlist3, the page will take them to /brands automatically.
Can anyone help me out what to write in my .htaccess file.
I would recommend doing this with routes in CakePHP rather than the .htaccess file. See http://bakery.cakephp.org/articles/Frank/2009/11/02/cakephp-s-routing-explained for more details.
The following should do the trick:
RewriteEngine On
RewriteRule ^createwishlist3$ /brands [R=301,L,NC]
Hope this helps.

this is url rewrite is not working

i tried to create this url rule buts not working: i dont know why :(
orginal url
www.example.com/viewprofile.php?username=jhon
the desired friendly url is
www.example.com/user/jhon
this is my.htaccess code:
RewriteEngine On
RewriteRule ^username/([^/]*)$ /viewprofile.php?username=$1 [L]
thanks for helping!! :))
I found this tutorial where the author explain step by step how to do exactly what you are trying to do. See if it helps: http://www.emanueleferonato.com/2008/06/15/how-to-generate-friendly-urls-with-htaccess-part-2/

.htaccess rewrite for a simpleton

I can generally figure this kind of thing out on my own, but I'm totally lost on how to write a rewrite rule in .htaccess
my current url looks like:
index.php?p=page&v=2&i=2&pg=01
I'm trying to make the url look like this:
/vol2/iss2/pg01/
Any help greatly appreciated! Thanks!
Try something like following
RewriteEngine on
RewriteRule ^vol([0-9]+)/iss([0-9]+)/pg([0-9]+)/$ index.php?p=page&v=$1&i=$2&pg=$3

How to beautify the URL?

I am sick of this kind of URL:
www.domain.com/something/?id=person&photos=photoID&variable1=others&...
I am using apache, learning to write .htaccess now. Can anyone show me the basic code for this one?
Ugly:
www.domain.com/something/?id=person&photos=photoID
Goal:
www.domain.com/something/person/photoID
RewriteEngine on
RewriteRule ^something/(.*)/(.*)$ something/?id=$1&photos=$2 [QSA]
This is an extremely helpful article on Mod_Rewrite

Resources