Multiple rule Apache rewrite and standard pages

Posted on

Multiple rule Apache rewrite and standard pages – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about apache-2.2, php, mod-rewrite, , .

In reference to: Multiple rule Apache rewrite

While this works great for the multiple levels of item drill down I still have need for an admin.php page to run outside of the rule. Currently under this set of rules standard page/scripts wont run.


RewriteRule ^mr/index.php$ - [L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/?$ /mr/index.php?product_group=$1&product_family=$2&product_category=$3&product_sub_category=$4&product=$5 [L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/?$         /mr/index.php?product_group=$1&product_family=$2&product_category=$3&product_sub_category=$4 [L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/?$                 /mr/index.php?product_group=$1&product_family=$2&product_category=$3 [L]
RewriteRule ^([^/]*)/([^/]*)/?$                         /mr/index.php?product_group=$1&product_family=$2 [L]
RewriteRule ^([^/]*)/?$                                 /mr/index.php?product_group=$1 [L]


RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^ - [L]

RewriteRule ^index.php$ - [L]

RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/?$ index.php?n_section=$1&n_product_group=$2&n_product_family=$3&n_product_category=$4&n_product_subcategory=$5 [L]

RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/?$         index.php?n_section=$1&n_product_group=$2&n_product_family=$3&n_product_category=$4 [L]

RewriteRule ^([^/]*)/([^/]*)/([^/]*)/?$                 index.php?n_section=$1&n_product_group=$2&n_product_family=$3 [L]

RewriteRule ^([^/]*)/([^/]*)/?$                         index.php?n_section=$1&n_product_group=$2 [L]

RewriteRule ^([^/]*)/?$                                 index.php?n_section=$1 [L]

Solution :

Put these lines at the top, above the existing RewriteRule lines. What it’ll do is check to see if the requested file exists, and if so it’ll skip the rest of the rewriting process, ignoring all the subsequent rules.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ - [L]

Leave a Reply

Your email address will not be published.