-1

How can I rewrite
www.mysite.com/name/subject/
to
www.mysite.com/index.php?page=name&s=subject?

Now I'm using:

Options +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteBase /

Don't match internal sub requests:
RewriteCond %{ENV:REDIRECT_STATUS} ^$

Match the query string variable:
RewriteCond %{QUERY_STRING} ^(.*&)?page=(name1|name2)(&.*)?$ [NC]

Match the file and redirect:
RewriteRule ^(index\.php)?$ /%2/? [NC,R=301,L]
RewriteRule ^(name1|name2)\/$ /index.php?page=$1 [QSA,L]

And it's working but only until www.mysite.com/name1/

adaptr
  • 16,576
  • 23
  • 34

1 Answers1

1

RewriteConds apply to the next following RewriteRule.

Also, don't use .htaccess unless you have no alternative; whenever you have access to httpd.conf, you should put your rewrites there instead.

adaptr
  • 16,576
  • 23
  • 34
  • Thank you, but unfortunately I don't have access to httpd.conf because my access on server is limited to a simple cpanel. – Andrei C Jan 29 '13 at 11:04