RewriteRule from subfolder path to another subfolder path

507 views Asked by At

I'm currently creating a bunch for RewriteRules for a customer migrating their website to a new platform and having a weird issue with the following rule:

RewriteRule ^/folder/filename.cfm  /another_folder/subfolder/filename.cfm?name=value

I've never had problems with the right side of the rule, which BTW the URL does work. But the left side is my first with a folder.

So what happens is I get as a 404 error. But the following rule will work just fine.

RewriteRule ^filename.cfm  /another_folder/subfolder/filename.cfm?name=value

Anyone have any ideas. BTW, were this is on a Windows system using Helicon Ape Manager.

2

There are 2 answers

1
Yaroslav On BEST ANSWER

I guess you are using .htaccess file inside /folder/? Here is quote from Helicon Ape documentation Context and processing order :

Remember when RewriteRule directive is used inside .htaccess configuration files it will automatically strip the local directory prefix from the path and apply rules only to the remainder. You can use RewriteBase directive to explicitly specify a base path for the rules.

0
Salsero69 On

The issue I discovered after using an HTTP request sniffer is that APE will normalize the redirecting links. So a link that includes %2E will get escaped to %372E. And so the links were becoming invalid.