Question

i have a site

site.com/?w=thisworks
site.com/w/thisalsoworksmanually

i got this to work via htaccess

now i have a form... when it gets submitted

i get site.com/?w=stuffsubmitted i'm trying to have it auto redirect to site.com/w/stuffsubmitted

here is my htaccess that works

RewriteEngine on

RewriteRule ^w/([^/]+)/?$ /index.php?w=$1 [L]

basically..i want to auto redirect to a clean url when form gets submitted.. if you need some more clarification..please ask.

Was it helpful?

Solution

You redirect from the worng way, you redirect site.com/w/stuffsubmitted to site.com/?w=stuffsubmitted and you say that you want to redirect url with query string to that which don't have one.

RewriteCond %{query_string} w=(.*)
RewriteRule ^$ /w/%1? [R=301]

OTHER TIPS

Simple solution. Don't submit form with method="GET". If you have to submit POST form, you will write manually action url.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top