Jump to content

Using htaccess for CMS


ILMV

Recommended Posts

Here is a .htaccess I use for a web app. it remaps all incoming urls to the .index.php as path variable simillar to what you are trying.

 

example:

http://www.mydomain.com/category/test

 

ends up as:

http://www.mydomain.com/index.php?__page=category/test/

 

You will probably need to change the rules at the end around to be page instead of __page and maybe change up the images/css/js part

 

 

###################################################
# Turn the RewriteEngine on.                      #
###################################################

RewriteEngine on

##################################################
# Properly rout for other web apps              #
#################################################


###################################################
# 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]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ /index.php?__page=$1&%{QUERY_STRING} [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/?$ /index.php?__page=$1/$2&%{QUERY_STRING} [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ /index.php?__page=$1/$2/$3&%{QUERY_STRING} [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /index.php?__page=$1/$2/$3/$4&%{QUERY_STRING} [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /index.php?__page=$1/$2/$3/$4/$5&%{QUERY_STRING} [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /index.php?__page=$1/$2/$3/$4/$5/$6&%{QUERY_STRING} [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /index.php?__page=$1/$2/$3/$4/$5/$6/$7&%{QUERY_STRING} [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /index.php?__page=$1/$2/$3/$4/$5/$6/$7/$8&%{QUERY_STRING} [L]
RewriteCond %{REQUEST_FILENAME} !-f
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.