.htaccess RewriteRule without Redirect
If the folder contains 2 letters (example: zz) then execute file (foofile) without redirecting to it. foofile's text output is to be shown on the browser.
URI accessed by browser:http://www.mysite.com/zz/folder1/file1 File to be executed: http://www.mysite.com/foofile?var1=zz&var2=/folder1/file1
This is not working since the browser shows a 404 (not found)开发者_高级运维 error:
RewriteCond %{REQUEST_URI} ^/../.*$
RewriteRule ^/(..)(/.*)$ /foofile?var1=$1&var2=$2
Try to remove preceding slashes in your RewriteRule
:
RewriteRule ^(..)(/.*)$ foofile?var1=$1&var2=$2
And your RewriteCond
isn't necessary.
Try this:
RewriteEngine On
RewriteRule ^/(..)(/.*)$ /foofile?var1=$1&var2=$2
And check apache's error log
You don't need RewriteCond, as the RewriteRule already checks if the URL matches.
精彩评论