regex - .htaccess RewriteRule for directory -


i use rewriterule following

www.mysite.com/xyz or www.mysite.com/xyz/ 

==> should go www.mysite.com/page.php?var=xyz

www.mysite.com/xyz.html www.mysite.com/xyz.htm www.mysite.com/xyz.php or other extension 

==> should not rewritten

only when there's no file extension, rewrite rule should used thanks!

put code in document_root/.htaccess file:

rewriteengine on  rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^([^.]+?)/?$ /page.php?var=$1 [l,qsa] 

Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -