Jump to content

[SOLVED] Incoming URL Parsing


Recommended Posts

Okay, CRAZY maybe off-topic question but an answer would improve my ability to understand a problem I've encountered.

 

When I have a product referenced by the URL shown below:

 

www.domain_name.com/ps/sunglasses/137-strike-king-s11-sunglasses.html

 

HOW does Prestashop get invoked?

 

The actual installation is located at public_html/ps/. There is no folder named "sunglasses" nor a physical file named "137-strike-king-s11-sunglasses.html".

 

Does the server look for the file, can't find it and an error handler invokes the controller? How does it get from "Can't find A" to "Send B instead"?

 

What happens if the actual installation DOES include a folder named sunglasses and that folder is protected?

 

Thanks,

Barry

---

SOLUTION:

 

Change to .htaccess file in /tools folder allows use of the word "tools" as a category.

 

https://github.com/PrestaShop/PrestaShop/commit/63c7915a102782f3e9241c5b04edd08a23a553c9

 

Edited by BarryH (see edit history)
Link to comment
Share on other sites

Okay. So far I gather that .htaccess, mod_rewrite and dispatcher.php have roles to play in this process but I'm still putting the pieces together. It sounds like the file system takes precedence over mod_rewrite so I'm still left with...

 

What happens if the actual installation DOES include a folder named sunglasses and that folder is protected?

Link to comment
Share on other sites

Well, yes and no. I am trying to understand and resolve a problem that matches my description.

 

If I create a category "Tools", associate a product with "Tools" and then attempt to VIEW that product, my site returns an access error. If I rename the category anything else, it works fine. Coincidentally, there is a folder named "Tools" at the same directory level as the "Tools" category virtual folder. I originally assumed that the server was trying to access the physical file folder rather than the virtual Prestashop folder. On the basis that perhaps there were "reserved words" that couldn't be used in category names, I reported it in Bug Tracker. So far, they've been unable to reproduce the error so I'm continuing to drill down.

 

As I learn more about .htaccess and the RewriteRules, I can see a path for this error to happen and I'm trying to isolate the root cause so I can put together a fix. Although I am a programmer, I am not familiar with RewriteRules so I'm trying to ramp us as quickly as possible.

Link to comment
Share on other sites

Well, yes and no. I am trying to understand and resolve a problem that matches my description.

 

If I create a category "Tools", associate a product with "Tools" and then attempt to VIEW that product, my site returns an access error. If I rename the category anything else, it works fine. Coincidentally, there is a folder named "Tools" at the same directory level as the "Tools" category virtual folder. I originally assumed that the server was trying to access the physical file folder rather than the virtual Prestashop folder. On the basis that perhaps there were "reserved words" that couldn't be used in category names, I reported it in Bug Tracker. So far, they've been unable to reproduce the error so I'm continuing to drill down.

 

As I learn more about .htaccess and the RewriteRules, I can see a path for this error to happen and I'm trying to isolate the root cause so I can put together a fix. Although I am a programmer, I am not familiar with RewriteRules so I'm trying to ramp us as quickly as possible.

 

folder tools in your ps installation has .htaccess deny, I've opened a bug report on this.

 

so for tools you would see a 403 forbidden when category also named tools.

Link to comment
Share on other sites

See PSCSX-4099.

 

Also, by extension (no pun intended), wouldn't this same problem exist for most of the folder names in the base directory? Just glancing at a few of them, it seems many have the same .htaccess deny all rules (log, docs, override).

 

Answer: Yes. Renamed problematic "Tools" category to "Docs". Same 403 forbidden.

Renamed "Docs" to "Hand Tools". Everything works fine.

Edited by BarryH (see edit history)
Link to comment
Share on other sites

Question: If I force a regeneration of .htaccess by removing .htaccess from the base, will Prestashop regenerate all of the .htaccess files throughout all of the Prestashop installation folders?

I have never seen Prestashop do that, only the .htaccess in the root folder

Link to comment
Share on other sites

×
×
  • Create New...