-3

I am a new bee and I want to redirect following URL

m.site.com/subfolder/index.php?user=xxx

to a search engine frendly url like below using .htacess mode rewrite

m.site.com/subfolder/xxx

please explain me the correct way

user3025146
  • 19
  • 1
  • 5
  • This site is not a coding service. Please see [How do I ask a good question?](http://stackoverflow.com/help/how-to-ask) – Celeo Nov 18 '14 at 19:53
  • possible duplicate of [Reference: mod\_rewrite, URL rewriting and "pretty links" explained](http://stackoverflow.com/questions/20563772/reference-mod-rewrite-url-rewriting-and-pretty-links-explained) – Michael Berkowski Nov 18 '14 at 19:56
  • redirect on sub domains like this are not explained – user3025146 Nov 18 '14 at 20:00

1 Answers1

0

You can use in the .htaccess file, in the subfolder (It is important):

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{QUERY_STRING} ^user=(.+)$
RewriteRule ^ %1? [R=302,L]

RewriteRule ^(.*)$ index.php?user=$1 [L]

Change R=302 for R=301 when test work well.

Croises
  • 18,302
  • 4
  • 25
  • 45