Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19

This is a discussion on .htaccess question in the Design and Development forum
Assuming you meant that the redirect in the post #13 (just above yours) is the one you've settled on... We will add 3 lines in ...

  1. #16
    Ron
    Ron is offline
    Loyal Client
    Join Date
    Aug 2002
    Posts
    7,304
    Assuming you meant that the redirect in the post #13 (just above yours) is the one you've settled on... We will add 3 lines in front of the previous code.

    Code:
    RewriteEngine On 
    RewriteCond %{REQUEST_URI} ^/gallery2/main.php$ [NC]
    RewriteCond %{QUERY_STRING} !^g2_item(.*)$
    RewriteRule ^(.*) http://mysite.com/gallery2/index.php/? [L,R=301]
    
    RewriteRule ^main\.php(.*)$ index.php/g2/map?path=main.php   [QSA,L]
    This says:
    IF the request_uri is main.php (case independent) AND the query_string does not start with "g2_item"
    THEN externally redirect to index.php/, erase any query string, return status 301, stop processing any more rules.

    ELSE (same as previously)

    IF the request_uri is for main.php
    THEN internally redirect to index.php/g2/map?path=main.php, append the original query string, stop processing any more rules.


    I don't have the ability to test this right now, but I THINK that this will work for what you've just asked.
    Mod_rewrite can be tricky, so please test all the conditions, including "www." prefix, g2 and non-g2 query strings and blank query strings
    Last edited by Ron; 02-14-2012 at 01:57 AM.
    Good luck

  2. #17
    Ron
    Ron is offline
    Loyal Client
    Join Date
    Aug 2002
    Posts
    7,304
    FYI I tested this and it appears to be working properly.

    I'd still be testing it in your particular environment if I were you. Server setups can affect the way mod-rewrite behaves.
    Good luck

  3. #18
    Loyal Client
    Join Date
    May 2006
    Posts
    29
    Looks like that works well as far as I can tell. Many thanks again Ron, I really appreciate it.

  4. #19
    Ron
    Ron is offline
    Loyal Client
    Join Date
    Aug 2002
    Posts
    7,304
    Great! Feel free to share.
    Good luck

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •