Jump to content

using periods in rewritten urls gives 404


kevisazombie

Recommended Posts

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]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.