Koozali.org: home of the SME Server

rewrite issue

Offline jameswilson

  • *
  • 795
  • +0/-0
    • Security Warehouse, professional security equipment
rewrite issue
« on: July 03, 2025, 06:25:03 PM »
Not a SME Issue but ive noticed a significat drop in traffic
Anyhow ive found out some pages are causing errors this is one of them
https://www.securitywarehouse.co.uk/catalog/intruder-alarm-equipment-c-36/movement-detectors-c-36_116/all-c-36_116_37/bosch-blue-line-gen2-pet-friendly-passiveinfrared-detector-p-2292.html

and the error shown is www.securitywarehouse.co.uk redirected you too many times.

im assuming i have a setting error in htaccess but i have no clue where to start
Any pointers please

Ta
James

Offline Jean-Philippe Pialasse

  • *
  • 2,919
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: rewrite issue
« Reply #1 on: July 04, 2025, 10:47:09 PM »
looking at your htaccess ?

Offline mmccarn

  • *
  • 2,657
  • +10/-0
Re: rewrite issue
« Reply #2 on: July 05, 2025, 01:05:24 PM »
If you suspect your htaccess file you could try this online htaccess tester: https://htaccess.madewithlove.com/

I found the tester above in this stackoverflow question:

Tips for debugging .htaccess rewrite rules
Asked 13 years, 5 months ago
Modified 6 months ago
Viewed 147k times


Offline jameswilson

  • *
  • 795
  • +0/-0
    • Security Warehouse, professional security equipment
Re: rewrite issue
« Reply #3 on: July 08, 2025, 04:20:03 PM »
mmccarn
Thanks for the link to htaccess tester but i dont understand the output but it doesnt look good

https://htaccess.madewithlove.com?share=d19e705a-d8de-4709-b6f9-ad0cd120c8d3

Offline jameswilson

  • *
  • 795
  • +0/-0
    • Security Warehouse, professional security equipment
Re: rewrite issue
« Reply #4 on: July 15, 2025, 06:00:37 PM »
is it safe to post the htaccess file?

Offline ReetP

  • *
  • 3,960
  • +6/-0
Re: rewrite issue
« Reply #5 on: July 16, 2025, 11:41:13 AM »
is it safe to post the htaccess file?

As long as it doesn't include any personal information or obvious security issues :-)
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline mmccarn

  • *
  • 2,657
  • +10/-0
Re: rewrite issue
« Reply #6 on: July 16, 2025, 01:09:29 PM »
Your htaccess file is already available in the link you sent to the htaccess tester.

Note that in that site, it appears that only one product ID produces the infinite redirect issue. 

If I change the product ID I get a real product page...

On the htaccess tester site:

Input URL:
https://www.securitywarehouse.co.uk/catalog/intruder-alarm-equipment-c-36/movement-detectors-c-36_116/all-c-36_116_37/bosch-blue-line-gen2-pet-friendly-passiveinfrared-detector-p-2292.html

Output URL:
https://www.securitywarehouse.co.uk/index.php?main_page=product_info&products_id=2292&cPath=36_116_37&

...then put the output URL into the Input URL field:

Input URL:
https://www.securitywarehouse.co.uk/index.php?main_page=product_info&products_id=2292&cPath=36_116_37&

Output URL (identical):
https://www.securitywarehouse.co.uk/index.php?main_page=product_info&products_id=2292&cPath=36_116_37&

Result:
"The page isn’t redirecting properly"

If you change products_id to 2291 and repeat:

Input URL:
https://www.securitywarehouse.co.uk/index.php?main_page=product_info&products_id=2291&cPath=36_116_37&

Output URL:
https://www.securitywarehouse.co.uk/index.php?main_page=product_info&products_id=2291&cPath=36_116_37&

Result: Model: ISC-BPR2-W12

...so there there seems to be something unique about products_id 2292
« Last Edit: July 16, 2025, 02:43:10 PM by mmccarn »

Offline mmccarn

  • *
  • 2,657
  • +10/-0
Re: rewrite issue
« Reply #7 on: July 16, 2025, 01:48:23 PM »
Note that if you don't find an actual problem with "-p-2292", you could update your htaccess to rewrite only that id to something else:

Code: [Select]
. # Handles the new URL formats
+ RewriteRule ^(.*)-c-([0-9_]+)/(.*)-p-2292(.*)$ index.php?main_page=product_info&products_id=2291&cPath=$2&%{QUERY_STRING} [L]
  RewriteRule ^(.*)-c-([0-9_]+)/(.*)-p-([0-9]+)(.*)$ index.php?main_page=product_info&products_id=$4&cPath=$2&%{QUERY_STRING} [L]
  RewriteRule ^(.*)-c-([0-9_]+)/(.*)-pi-([0-9]+)(.*)$ index.php?main_page=popup_image&pID=$4&cPath=$2&%{QUERY_STRING} [L]
...

Offline mmccarn

  • *
  • 2,657
  • +10/-0
Re: rewrite issue
« Reply #8 on: July 16, 2025, 02:26:13 PM »
There is a rule near the top of your htaccess that matches any URL containing "index.php".

I found this note on stackoverflow indicating you might get what you want by change the action on that rule from [L] to [END]

Code: [Select]
- RewriteRule ^index\.php$ - [L]
+ RewriteRule ^index\.php$ - [END]
« Last Edit: July 16, 2025, 02:40:50 PM by mmccarn »