kevisazombie Posted March 31, 2009 Share Posted March 31, 2009 Hi all, I have inherited a project that has a .htaccess file that rewrites all URLS to the index.php file in a query string. I have run in to a problem where using periods in the URLs will throw a 404. I need this functionality for URLs like this: http://www.mysite.com/admin/search/email/useremail@mysite.com or: http://www.mysite.com/product/phpfreaks.com_Logo I am kind of green on .htaccess and Regex but I have tried some edits like dropping the \. from capturing groups to no avail. I hope this is an easy fix thanks for any help! AddHandler application/x-httpd-php5 .php ################################################### # Turn the RewriteEngine on. # ################################################### RewriteEngine on ################################################### # Do not process images or CSS files further # ################################################### # No more processing occurs if this rule is # # successful # ################################################### RewriteRule (images|css|scripts|js)/(.+)$ $1/$2 ################################################### # Add a trailing slash if needed # ################################################### # If this rule is used, the rewriting stops here # # and then restarts from the beginning with the # # new URL # ################################################### RewriteCond %{REQUEST_URI} ^/[^\.]+[^/]$ RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [R=301,L] ################################################### # Rewrite web pages to the index page # ################################################### # No more processing occurs if any of these rules # # are successful # ################################################### #RewriteRule ^(.*)/?$ /index.php?__page=$1&%{QUERY_STRING} [L] RewriteRule ^([^/\.]+)/?$ /index.php?__page=$1&%{QUERY_STRING} [L] RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /index.php?__page=$1/$2&%{QUERY_STRING} [L] RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?__page=$1/$2/$3&%{QUERY_STRING} [L] RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?__page=$1/$2/$3/$4&%{QUERY_STRING} [L] RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?__page=$1/$2/$3/$4/$5&%{QUERY_STRING} [L] RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?__page=$1/$2/$3/$4/$5/$6&%{QUERY_STRING} [L] RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?__page=$1/$2/$3/$4/$5/$6/$7&%{QUERY_STRING} [L] RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?__page=$1/$2/$3/$4/$5/$6/$7/$8&%{QUERY_STRING} [L] RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?__page=$1/$2/$3/$4/$5/$6/$7/$8/$9&%{QUERY_STRING} [L] Quote Link to comment https://forums.phpfreaks.com/topic/151866-using-periods-in-rewritten-urls-gives-404/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.