rewrite rule query string replacement & subfolder problems
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > rewrite rule query string replacement & subfolder problems




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    rewrite rule query string replacement & subfolder problems  
Paul Furman


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-27-07 06:22 AM

What I want to do is instead of the internal url:
localhost/gallery/california?PG=1&PIC=2
use this kind of url:
localhost/gallery/california/pg1pc2


I'm working with a consultant, here's some instant message discussion
that explains it:


consultant:
in your local apache configuration file, add the following:
RewriteEngine On
RewriteRule ^(.*)pc([0-9]+)$ $1?PIC=$2 [NC,QSA]
RewriteRule ^(.*)/?pg([0-9]+)$ $1?PG=$2 [NC,QSA]

works like a charm
doesn't work at all in .htaccess files because of some helpful behavior
by Apache

me:
I thought htaccess should overwrite config settings?

consultant:
it does. the problem is that .htaccess files are designed to be
per-directory settings, this would work great if you had a real
directory structure and .htaccess files all over those directories
but it doesn't work in the top-level .htaccess because Apache always
adds the subdirectory back to the request
for example: localhost/gallery/california/pg1pc2
gets changed to localhost/gallery/california/pg1pc2?PIC=2
and of course, the second rule won't match

--
Paul Furman Photography
http://www.edgehill.net/1
Bay Natives Nursery
http://www.baynatives.com





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:56 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register