HTACCESS File Has Absolutely No Impact

Hi,

I have a detailed htaccess file which I was looking to edit. I made some changes to it and found that now changes were occuring ot my site. So I deleted the file outright and yet my site operates in completely the same way without the htaccess file.

The confusing thing is that I have to have the htaccess file built for the purposes I was looking to be done.

Options -Indexes
Options -MultiViews
Options +FollowSymLinks

# Prevent viewing of htaccess file
<Files ~ "^\\.ht">
order allow,deny
deny from all
satisfy all
</Files>

# Disable directory listing from this point
Options -Indexes


# Error Pages
ErrorDocument 404 /404-error.php

# Rewrite Rules
<IfModule mod_rewrite.c>
RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^products/product/([0-9]+)/(.*)$ products/product.php?product_id=$1 [QSA,L]
  RewriteRule ^products/(.*)/(.*)$ products/$1.php?product_id=$2 [QSA,L]
  RewriteRule ^products/nameproductscategorised/(.*)$ products/nameproductscategorised.php?linkname=$1&name=$1 [QSA,L]
  RewriteRule ^products/product/([0-9]+)/(.*)$ products/product.php?product_id=$1 [QSA,L]
  RewriteRule ^articles/article/([0-9]+)/(.*)$ articles/article.php?ID=$1 [QSA,L]
    RewriteRule ^articles/articlesfiltered/([A-Za-z]+)/(.*)$ articles/articlesfiltered.php?articlecategory=$1 [QSA,L]
  RewriteRule ^plusstyle/plusstyle/([0-9]+)/(.*)$ plusstyle/plusstyle.php?ID=$1 [QSA,L]
   RewriteRule ^plusstyle/plusstylesfiltered/([A-Za-z]+)/(.*)$ plusstyle/plusstylesfiltered.php?articlecategory=$1 [QSA,L]
     RewriteRule ^([a-z]+)/([a-z\\-]+)$ /$1/$2.php [QSA,L]
	   RewriteRule ^products/roomproductscategorised/(.*)$ products/roomproductscategorised.php?room=$1 [QSA,L]
</IfModule>

Are you on Wordpress! Or a dedicated server? And Clear cache

A quick and ugly way to check if an .htaccess file is being loaded is to put an obvious error in it. For example, put

adsf

as the first line. If that file is being loaded, your site will not work at all (that’s the ugly part).

This is really more of a server config question though you may find some help in this PHP forum. There are a number of reasons the file isn’t being loaded by apache: it’s in the wrong place or you’re looking at the wrong .htaccess file, permissions of the file are wrong, the server is configured not to use them, file is named wrong.

So first I would find out if the file you’re looking at is being loaded at all. See my ugly check above.

PT - this is NOT WP code.

JLU,

PT is correct about the cache and QM’s test will show whether your .htaccess is being parsed (it should throw a 500 error if it is).

As for your code, though, a few comments might help you.

Options -Indexes
Options -MultiViews
Options +FollowSymLinks

# Prevent viewing of htaccess file
<Files ~ "^\\.ht">
order allow,deny
deny from all
satisfy all
</Files>

# Disable directory listing from this point
Options -Indexes

# Error Pages
ErrorDocument 404 /404-error.php

# Rewrite Rules
[COLOR="#FF0000"]<IfModule mod_rewrite.c>
# Make this test ONCE, NOT multiple times for every file request!!![/COLOR]
RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^products/product/([0-9]+)/(.*)$ products/product.php?product_id=$1 [QSA,L]
# End of RewriteCond test effect, i.e., they were ONLY associated with this RewriteRule

  RewriteRule ^products/[COLOR="#A52A2A"](.*)/(.*)[/COLOR]$ products/$1.php?product_id=$2 [QSA,L]
# This is a "catch-all" which will prevent the next two RewriteRules from being matched

  RewriteRule ^products/nameproductscategorised/(.*)$ products/nameproductscategorised.php?linkname=$1&name=$1 [QSA,L]
  RewriteRule ^products/product/([0-9]+)/(.*)$ products/product.php?product_id=$1 [QSA,L]

  RewriteRule ^articles/article/([0-9]+)/(.*)$ articles/article.php?ID=$1 [QSA,L]
  RewriteRule ^articles/articlesfiltered/([A-Za-z]+)/(.*)$ articles/articlesfiltered.php?articlecategory=$1 [QSA,L]

  RewriteRule ^plusstyle/plusstyle/([0-9]+)/(.*)$ plusstyle/plusstyle.php?ID=$1 [QSA,L]
  RewriteRule ^plusstyle/plusstylesfiltered/([A-Za-z]+)/(.*)$ plusstyle/plusstylesfiltered.php?articlecategory=$1 [QSA,L]

  RewriteRule ^([a-z]+)/([a-z[COLOR="#ff0000"]\\[/COLOR]-]+)$ /$1/$2.php [QSA,L]
# Not necessary within a character range definition.
# Because it's a metacharacter within a character range definition, best to put first (per Apache) but last works, too

  RewriteRule ^products/roomproductscategorised/(.*)$ products/roomproductscategorised.php?room=$1 [QSA,L]
[COLOR="#FF0000"]</IfModule>[/COLOR]

In general, proceed from the most specific rule (set) to the most general to prevent “hijacking” of specific rules by the general rule.

IF you need to skip all file and directories which exist, you can use the SKIP flag and logically invert your !-f/!-d tests, i.e.,

RewriteCond %{REQUEST_URI} -f [OR]
RewriteCond %{REQUEST_URI} -d
RewriteRule .? - [S=10]

… then continue with just your 10 RewriteRules.

Regards,

DK