简体   繁体   中英

.HTACCESS RewriteRule not working as expected

I have a magento website, that is currently operating. Within a subfolder of this site, I have placed a 3rd party application that also has its own HTACCESS file to handle routing for its application.

When I access the folder http://example.com/somefolder the screen I expect shows up, but when I navigate to http://example.com/somefolder/newroute , I instead land on a magento 404 screen.

I have traced this to the magento htaccess file, in all cases, unlesss the path physically exists the rewriterule will always send the request to the index.php - this explains why Im getting there.

To fix this issue, I wrote a little rewriterule which I placed in the htaccess file of the magento store. The goal was to add an exception to any request that came through and contained any reference to my subfolder. The thought is now it should hit the path its supposed, then hit the htaccess file, and then route me to where IM supposed to be in this other application. Unfortunately it doesnt seem to work, after adding the rule I end up the same place - magento.

Here is what I've written:

RewriteRule ^(.*somefolder.*)$ $1 [L]

Im not sure what could be going wrong, as I think the approach seems pretty straight forward. Any ideas on how to remedy this situation?

Thanks.

这是您的简单答案。我在我的网站上也使用过。

    RewriteCond %{REQUEST_URI} !^/(yourfoldernameHERE)$

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM