Rewrite URL with .htaccess
Posted
by
Joaquin McCoy
on Stack Overflow
See other posts from Stack Overflow
or by Joaquin McCoy
Published on 2010-12-24T17:50:46Z
Indexed on
2010/12/24
17:54 UTC
Read the original article
Hit count: 427
mod-rewrite
Hi guys, I've this url: http://www.test.com/page.php?k=m1ns
and I want this one: http://www.test.com/r/m1ns
My .htaccess:
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteRule ^k/([^/\.]+)/?$ page.php?k=$1 [L]
# force www. in all requests
RewriteCond %{HTTP_HOST} ^test\.com [NC]
RewriteRule ^(.*)$ http://www.test.com/$1 [L,R=301]
# enable hiding php extension
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
But it doesn't work. Only the non-www -> www and hiding php rules works. If I put http://www.test.com/page.php?k=m1ns does not rewrite.
Anyone knows why?
Thanks.
© Stack Overflow or respective owner