I need htaccess rule that rewrites an uri into get variable if it is not for an existing file or folder. Example:
www.example.com/page1.php -> goto page1.php
www.example.com/page2.html -> goto page2.html
www.example.com/folder -> goto /folder
www.example.com/some_string_value -> rewrite as /default.php?value=some_string_value
That's really a very common request. There are probably 1000's of questions about this asked on this site. You need to use the
RewriteCond
andREQUEST_FILENAME
to look for non existent folder and then internally rewrite to get variable. Essentially if it's a404 (non existent URI)
it will be routed to your default.php file. That's how pretty URL's are done. You can put this in your .htaccess file in the root.