Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

As soon as my .htaccess goes over approx 8410 bytes, I get a 500 Internal Server Error.

I don't think this is due to a bad redirect, as I have experimented with redirects in the .htaccess and then with just text that is commented out #. (no actual commands in the .htaccess file)

Is there anything obvious that can cause this?

Update:

The site is on WordPress.

Here are the redirects I was originally trying to add:

RewriteEngine On

## 301 Redirects of old URLs to new
# 301 Redirect 1
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^accesseries/underlay/prod_37\.html$ /product-category/accessories/underlays? [R=301,NE,NC,L]

# 301 Redirect 2
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^accessories/acoustic-underlay/prod_29\.html$ /product/acoustic-underlay/? [R=301,NE,NC,L]

# 301 Redirect 3
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^accessories/cat_4\.html$ /product-category/accessories/? [R=301,NE,NC,L]

# 301 Redirect 4
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^-bamboo-flooring/accessories/cat_8\.html$ /product-category/accessories/? [R=301,NE,NC,L]

# 301 Redirect 5
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^-bamboo-flooring/bamboo-floor/natural-strandwoven-bamboo-semi-gloss-wide-board-135mm-click/prod_151\.html$ /product/natural-strand-woven-bamboo-semi-gloss-wide-board-135mm-click/? [R=301,NE,NC,L]

# 301 Redirect 6
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^-bamboo-flooring/bamboo-floor/strandwoven-chocolate-135mm-bamboo-flooring/prod_174\.html$ /product/strand-woven-chocolate-135mm-bamboo-flooring/? [R=301,NE,NC,L]

# 301 Redirect 7
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^-bamboo-flooring/bamboo-floor/strand-woven-kempas-bamboo-flooring/prod_173\.html$ /product/strand-woven-kempas-bamboo-flooring/? [R=301,NE,NC,L]

# 301 Redirect 8
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^-bamboo-flooring/bamboo-floor/strandwoven-walnut-wired-135mm-bamboo-flooring/prod_176\.html$ /product/strand-woven-walnut-wired-135mm-bamboo-flooring/? [R=301,NE,NC,L]

# 301 Redirect 9
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^-bamboo-flooring/cat_7\.html$ /product-category/bamboo-floor/? [R=301,NE,NC,L]

# 301 Redirect 10
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^-bamboo-installation/info_8\.html$ /bamboo-installation/? [R=301,NE,NC,L]

# 301 Redirect 11
RewriteCond %{QUERY_STRING}  ^act=cart$ [NC]
RewriteRule ^cart\.php$ /cart/? [R=301,NE,NC,L]

# 301 Redirect 12
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^contact-us/info_2\.html$ /contact-us/? [R=301,NE,NC,L]

# 301 Redirect 13
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^faqs/info_9\.html$ /faqs/? [R=301,NE,NC,L]

# 301 Redirect 14
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^-floating-timber-floor/black-butt-engineered-floating-timber/prod_213\.html$ /product/black-butt-engineered-floating-timber/? [R=301,NE,NC,L]

# 301 Redirect 15
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^-floating-timber-floor/doussie-engineered-floating-timber/prod_208\.html$ /product/doussie-engineered-floating-timber/? [R=301,NE,NC,L]

# 301 Redirect 16
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^-floating-timber-floor/smoked-oak-engineered-floating-timber/prod_217\.html$ /product/smoked-oak-engineered-floating-timber/? [R=301,NE,NC,L]

# 301 Redirect 17
RewriteCond %{QUERY_STRING}  ^act=thanks$ [NC]
RewriteRule ^index\.php$ http://www.xxxxxxxxxx.com/? [R=301,NE,NC,L]

# 301 Redirect 18
RewriteCond %{QUERY_STRING}  ^act=viewCat&catId=13$ [NC]
RewriteRule ^index\.php$ /product-category/samples/bamboo-flooring-samples/? [R=301,NE,NC,L]

# 301 Redirect 19
RewriteCond %{QUERY_STRING}  ^act=viewCat&catId=18$ [NC]
RewriteRule ^index\.php$ /product/bamboo-plastic-composite/? [R=301,NE,NC,L]

# 301 Redirect 20
RewriteCond %{QUERY_STRING}  ^act=viewCat&catId=2$ [NC]
RewriteRule ^index\.php$ /product-category/bamboo-floor/? [R=301,NE,NC,L]

# 301 Redirect 21
RewriteCond %{QUERY_STRING}  ^act=viewCat&catId=20$ [NC]
RewriteRule ^index\.php$ /products/? [R=301,NE,NC,L]

# 301 Redirect 22
RewriteCond %{QUERY_STRING}  ^act=viewCat&catId=3$ [NC]
RewriteRule ^index\.php$ /product-category/floating-timber-floor/? [R=301,NE,NC,L]

# 301 Redirect 23
RewriteCond %{QUERY_STRING}  ^act=viewCat&catId=5$ [NC]
RewriteRule ^index\.php$ /product-category/laminate-flooring/? [R=301,NE,NC,L]

# 301 Redirect 24
RewriteCond %{QUERY_STRING}  ^act=viewCat&catId=6$ [NC]
RewriteRule ^index\.php$ /product-category/accessories/? [R=301,NE,NC,L]

# 301 Redirect 25
RewriteCond %{QUERY_STRING}  ^act=viewCat&catId=saleItems$ [NC]
RewriteRule ^index\.php$ /product-category/clearance-sale/? [R=301,NE,NC,L]

# 301 Redirect 26
RewriteCond %{QUERY_STRING}  ^act=viewDoc&docId=3$ [NC]
RewriteRule ^index\.php$ /faqs/? [R=301,NE,NC,L]

# 301 Redirect 27
RewriteCond %{QUERY_STRING}  ^act=viewDoc&docId=4$ [NC]
RewriteRule ^index\.php$ /faqs/? [R=301,NE,NC,L]

# 301 Redirect 28
RewriteCond %{QUERY_STRING}  ^act=viewProd&productId=137$ [NC]
RewriteRule ^index\.php$ /product/laminate-flooring-goustein-wood/? [R=301,NE,NC,L]

# 301 Redirect 29
RewriteCond %{QUERY_STRING}  ^act=viewProd&productId=164$ [NC]
RewriteRule ^index\.php$ /product/modern-black-brushed-finish-strand-woven-flooring/? [R=301,NE,NC,L]

# 301 Redirect 30
RewriteCond %{QUERY_STRING}  ^act=viewProd&productId=165$ [NC]
RewriteRule ^index\.php$ /product/lime-wash-strand-woven-bamboo-flooring/? [R=301,NE,NC,L]

# 301 Redirect 31
RewriteCond %{QUERY_STRING}  ^act=viewProd&productId=168$ [NC]
RewriteRule ^index\.php$ /product/country-bark/? [R=301,NE,NC,L]

# 301 Redirect 32
RewriteCond %{QUERY_STRING}  ^act=viewProd&productId=173$ [NC]
RewriteRule ^index\.php$ /product-category/bamboo-floor/14mm-bamboo-flooring/? [R=301,NE,NC,L]

# 301 Redirect 33
RewriteCond %{QUERY_STRING}  ^act=viewProd&productId=178$ [NC]
RewriteRule ^index\.php$ /product/blue-gum-136-floating-timber/? [R=301,NE,NC,L]

# 301 Redirect 34
RewriteCond %{QUERY_STRING}  ^act=viewProd&productId=199$ [NC]
RewriteRule ^index\.php$ /product/jarrah-laminate-floor-sample/? [R=301,NE,NC,L]

# 301 Redirect 35
RewriteCond %{QUERY_STRING}  ^act=viewProd&productId=205$ [NC]
RewriteRule ^index\.php$ /product/elm-12mm-laminate-floor-sample/? [R=301,NE,NC,L]

# 301 Redirect 36
RewriteCond %{QUERY_STRING}  ^act=viewProd&productId=209$ [NC]
RewriteRule ^index\.php$ /product/iroko-engineered-floating-timber/? [R=301,NE,NC,L]

# 301 Redirect 37
RewriteCond %{QUERY_STRING}  ^act=viewProd&productId=222$ [NC]
RewriteRule ^index\.php$ /product/european-oak-engineered-floating-timber-sample/? [R=301,NE,NC,L]

# 301 Redirect 38
RewriteCond %{QUERY_STRING}  ^act=viewProd&productId=236$ [NC]
RewriteRule ^index\.php$ /product/black-forest-5mm-vinyl-flooring/? [R=301,NE,NC,L]

# 301 Redirect 39
RewriteCond %{QUERY_STRING}  ^act=viewProd&productId=65$ [NC]
RewriteRule ^index\.php$ /product/stair-nose/? [R=301,NE,NC,L]

# 301 Redirect 40
RewriteCond %{QUERY_STRING}  ^act=viewProd&productId=83$ [NC]
RewriteRule ^index\.php$ /product/laminate-flooring-warm-teak/? [R=301,NE,NC,L]

# 301 Redirect 41
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^-laminate-flooring/12mm-laminate-flooring/blackbutt/prod_156\.html$ /product/blackbutt-12mm-laminate-floor/? [R=301,NE,NC,L]

# 301 Redirect 42
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^-laminate-flooring/12mm-laminate-flooring/tasmanian-oak/prod_171\.html$ /product/tasmanian-oak/? [R=301,NE,NC,L]

# 301 Redirect 43
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^-laminate-flooring/8-3mm-laminate-flooring/laminate-flooring-warm-teak/prod_8\.html$ /product/laminate-flooring-warm-teak/? [R=301,NE,NC,L]

# 301 Redirect 44
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^-laminate-flooring/accessories/cat_6\.html$ /product-category/accessories/? [R=301,NE,NC,L]

# 301 Redirect 45
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^-laminate-flooring/cat_5\.html$ /product-category/laminate-flooring/? [R=301,NE,NC,L]

# 301 Redirect 46
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^-laminate-flooring/country-classic-12mm-laminate/cat_19\.html$ /product-category/laminate-flooring/12mm-country-classic-laminate-floor/? [R=301,NE,NC,L]

# 301 Redirect 47
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^-laminate-installation/info_7\.html$ /laminate-installation/? [R=301,NE,NC,L]

# 301 Redirect 48
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^privacy-policy/info_4\.html$ /faqs/? [R=301,NE,NC,L]

# 301 Redirect 49
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^-quotation-request/info_5\.html$ /quotation-request/? [R=301,NE,NC,L]

# 301 Redirect 50
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^rainbow-flooring/cat_16\.html$ /product-category/rainbow-flooring/? [R=301,NE,NC,L]

# 301 Redirect 51
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^rainbow-flooring/walnut-rainbow-flooring/prod_112\.html$ /product/walnut-rainbow-flooring/? [R=301,NE,NC,L]

# 301 Redirect 52
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^samples/12mm-laminate-floor-samples/kempas-laminate-floor-sample/prod_195\.html$ /product/kempas-laminate-floor-sample/? [R=301,NE,NC,L]

# 301 Redirect 53
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^samples/12mm-laminate-floor-samples/spotted-gum-laminate-floor-sample/prod_196\.html$ /product/spotted-gum-laminate-floor-sample/? [R=301,NE,NC,L]

# 301 Redirect 54
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^samples/12mm-laminate-floor-samples/tasmanian-oak-laminate-floor-sample/prod_197\.html$ /product/tasmanian-oak-laminate-floor-sample/? [R=301,NE,NC,L]

# 301 Redirect 55
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^samples/bamboo-flooring-samples/cat_13\.html$ /product-category/samples/bamboo-flooring-samples/? [R=301,NE,NC,L]

# 301 Redirect 56
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^samples/bamboo-flooring-samples/rosewood-strandwoven-bamboo-floor-135mm-click-sample/prod_191\.html$ /product/rosewood-strand-woven-bamboo-floor-135mm-click-sample/? [R=301,NE,NC,L]

# 301 Redirect 57
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^samples/cat_9\.html$ /samples/? [R=301,NE,NC,L]

# 301 Redirect 58
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^samples/floating-timber-floor-samples/iroko-engineered-floating-timber-floor-sample/prod_223\.html$ /product/iroko-engineered-floating-timber-floor-sample/? [R=301,NE,NC,L]

# 301 Redirect 59
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^samples/floating-timber-floor-samples/jarrah-engineered-floating-timber-sample/prod_224\.html$ /product/jarrah-engineered-floating-timber-sample/? [R=301,NE,NC,L]

# 301 Redirect 60
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^samples/floating-timber-floor-samples/merbau-engineered-floating-timber-sample/prod_226\.html$ /product/merbau-engineered-floating-timber-sample/? [R=301,NE,NC,L]

# 301 Redirect 61
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^samples/floating-timber-floor-samples/spotted-gum-engineered-floating-timber-sample/prod_228\.html$ /product/spotted-gum-engineered-floating-timber-sample/? [R=301,NE,NC,L]

# 301 Redirect 62
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^samples/floating-timber-floor-samples/sydney-blue-gum-engineered-floating-timber-sample/prod_220\.html$ /product/sydney-blue-gum-engineered-floating-timber-sample/? [R=301,NE,NC,L]

# 301 Redirect 63
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^shop\.php/-laminate-flooring/accessories/laminate-flooring-accessories-click-stairnose/prod_251\.html$ /product/stair-nose/? [R=301,NE,NC,L]

# 301 Redirect 64
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^shop\.php/-laminate-flooring/country-classic-12mm-laminate/country-classic-polar-white/prod_243\.html$ /product/country-classic-polar-white/? [R=301,NE,NC,L]

# 301 Redirect 65
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^shop\.php/samples/12mm-laminate-floor-samples/country-classic-polar-white/prod_244\.html$ /product/country-classic-polar-white-sample/? [R=301,NE,NC,L]

# 301 Redirect 66
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^shop\.php/samples/12mm-laminate-floor-samples/rustic-oak-12mm-laminate-floor/prod_248\.html$ /product/rustic-oak-12mm-laminate-floor-sample/? [R=301,NE,NC,L]

# 301 Redirect 67
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^shop\.php/samples/vinyl-flooring-samples/cat_25\.html$ /product-category/samples/vinyl-flooring-samples/? [R=301,NE,NC,L]

# 301 Redirect 68
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^shop\.php/vinyl-flooring/cat_24\.html$ /product-category/vinyl-floor/? [R=301,NE,NC,L]

# 301 Redirect 69
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^solardeck-tiles/cat_22\.html$ /product-category/solardeck-tiles/? [R=301,NE,NC,L]

# 301 Redirect 70
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^solardeck-tiles/solardeck-tiles/prod_206\.html$ /product/solardeck-tiles/? [R=301,NE,NC,L]

# 301 Redirect 71
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^terms-conditions/info_3\.html$ /faqs/? [R=301,NE,NC,L]

I'm getting errors like this in my log:

Invalid command 'aminate-flooring/tasmanian-oak/prod_171\\.html$', perhaps misspelled or defined by a module not included in the server configuration, referer: http://www.xxxxxxxx.com/laminate-installation/

Invalid command ',NE,NC,L]', perhaps misspelled or defined by a module not included in the server configuration

Invalid command ',L]#', perhaps misspelled or defined by a module not included in the server configuration
share|improve this question

closed as off-topic by Stephen Ostermiller Nov 25 '13 at 2:55

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because it is unlikely to help anybody else. Examples include individual website reviews for SEO purposes and general website troubleshooting." – Stephen Ostermiller
If this question can be reworded to fit the rules in the help center, please edit the question.

1  
Check line endings. No additional white-space after ] for instance. –  w3d Sep 7 '13 at 15:49

2 Answers 2

At 8410 bytes, size is not the issue. The only imaginable issue with size would be if your system's memory was exceeded by Apache or other processes...

Without seeing the actual .htaccess, I suggest narrowing down the problem by successively removing lines. Also check that lines are ended with new-line characters \n so that they aren't combined (i.e., view it in a text editor that displays new-line characters).

Note: The above answer was offered prior to the comments below, and the OP adding updates about being on WordPress and including the .htaccess and error log snippets (see the comments and Question's edits).

share|improve this answer
    
As mentioned I've tested the file with only commented out text, such as '#testing', repeated over and over again. As soon as it goes over a certain file size I get a 500 status. Same with redirects. I've checked each one and they are fine, but as soon as there are enough added to go over a certain size I get a 500 again. I'm pretty sure its the file size, just not sure why its happening? –  Max Jun 14 '13 at 6:50
    
Have you checked for new-lines, and what does your error log say? Also, are you requesting any specific file, like a CGI script? –  dan Jun 14 '13 at 6:56
    
Aside from the above, I can only think that there might be an issue reading the .htaccess each request, so maybe you should use <Directory> in the config instead. –  dan Jun 14 '13 at 7:05
    
To elaborate on my last comment, loading a large .htaccess file from disk to memory and parsing it each request might eat up available resources. Using the config would be much more efficient and perhaps solve the problem. –  dan Jun 14 '13 at 7:23
    
This doesn't look like a memory issue to me, maybe a missing module or configuration issue. Having a look at it... In the meantime, I'mg going to add "Update:" above your edits, so my answer still makes sense :-) –  dan Jun 14 '13 at 8:25

I do not think it is related to file size at all.

Most probably, some of your lines are problematic, maybe contains control characters or such. Your best bet would be to try adding lines one by one and reloading, and see when you start getting errors - the line you added is likely the culprit (of course, you can optimize this one_by_one by adding half of the lines, and if there is not a problem then half of what is missing etc).

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.