I am trying to redirect any calls to a specific file extension (here .jphp) to another url, using the filename part of the call as a subfolder. I try:
RewriteEngine On
RewriteRule [^/]/([^\.jphp])\.jphp /js/$1/
It should ignore anything before the last “/”, then store the Filename in $1 and redirect to HOST/js//
What am i doing wrong?
A
^as the first character in a regex character class[]is an inversion.[^/]evaluates to “any character that is NOT a slash”, and the[^\.jphp]evalutes to “any charater that is NOT a.,j,porh.Since you’re not specifying charater repetition limits, you’re limiting your urls to be of the form
x/z.jphp
where x and z are any single characters which are NOT one of the excluded characters mentioned above.