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

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -