...

View Full Version : .htaccess url mod_rewrite query string



semiSkim
07-12-2011, 02: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.



http://localhost/module/pages/editPage/&id=1/

(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]

Cags
07-16-2011, 07: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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum