tricky .htaccess settings

  • 0 Replies
  • 4786 Views
*

raseone

  • Newbie
  • *
  • 1
  • +0/-0
    • View Profile
tricky .htaccess settings
« on: October 11, 2019, 06:40:00 PM »
I've set up a set of conditions & rules for a new website & I've found myself needing to combine rules that are in conflict.

## STRIP UNWANTED QUERY STRINGS FROM ALL BUT EXEMPTED FILES ##
RewriteCond %{query_string} .
RewriteCond %{THE_REQUEST} !^.*\/item\.php?(.*)
RewriteCond %{THE_REQUEST} !^.*\/free_item\.php?(.*)
RewriteRule (.*) /$1? [R=301,L]

## PRETTY URLS FOR DYNAMIC PAGES  V2 ##
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9]+)$ item.php?font=$1
RewriteRule ^([a-zA-Z0-9]+)/$ item.php?font=$1

Each of these works fine on their own & both play nice with all the other rules in the file. I'm a bit stumped as to why there is a conflict.

When these 2 are used together I get http://example.com/item.php with no parameter.

Looks like the first bit is stripping the query even though the file is exempted.

Any help would be greatly appreciated.

 




See Our Webmaster Tools for Windows and Mac

A1 Sitemap Generator
      
A1 Website Analyzer
      
A1 Keyword Research
      
A1 Website Download
      
A1 Website Search Engine
      
A1 Website Scraper