View Full Version : .htaccess url mod_rewrite query string

07-12-2011, 03:06 AM
All pages must redirect to a single file to be run: module.php

When a page has an extra variable in the query string such as below the images and links are broken on the page as they require '../' as a prefix.


(the above URL passes the module and id variable successfully)

Is there a way to pass extra query string values with a script without the URLS changing with the addition of a query string variable?

My .htaccess file:

RewriteEngine on
RewriteBase /

RewriteCond %{THE_REQUEST} ^.*\/index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !example.php
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ $1/ [L,R=301]

RewriteRule ^module/(.*)/$ module.php?module=$1 [NC]

07-16-2011, 08:31 AM
The URI you posted doesn't have a valid query string... But if you have a query srtring in a URI that you are rewritting and you want the query string to remain/be combined with the new ones you are adding, then you need to add the QSA flag.