peuge Posted September 8, 2008 Share Posted September 8, 2008 Hi all, A while back I saw a site which showed you how to rewrite urls using preg_match() and .htaccess... I cant for the life of me find it anymore. I would really appreciate it if any one could shed some light on the subject? Thanks in advance Link to comment https://forums.phpfreaks.com/topic/123226-rewriting-urls-using-preg_match/ Share on other sites More sharing options...
aschk Posted September 8, 2008 Share Posted September 8, 2008 Do you have a fuller explanation of what it is you're attempting to achieve in terms of rewriting urls? Usually .htaccess is used to interpret a url into another before it is passed to PHP. e.g. RewriteEngine on Options +FollowSymLinks RewriteRule index.php - [L] RewriteRule . /index.php [L] The above will redirect ALL urls to index.php, which is where I would expect your front controller (or dispatcher) so take the URL and chop it up into namespace/controller/action/params Also, the 1st rewriterule specifies that if you asked for index.php, do nothing, the 2nd says if you supplied ANY url that contains characters then go to index.php Link to comment https://forums.phpfreaks.com/topic/123226-rewriting-urls-using-preg_match/#findComment-636391 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.