Mod_rewrite "too many redirects" problem
Attempt
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]
RewriteCond %{HTTP_HOST} ^(.*)dev\.example\.edu$ [NC]
RewriteRule ^/test(.*)$ http://dev.example.edu/test/index.php/test$1 [NC]
</IfModule>
on apache 2.2 server to make this rewrite work to hide part of the "index.php / test" path.
everything I tried either scrolls the part of url (index.php / test) in the address bar, or gives the error "too many redirects".
I suspect that the "test" part of the equation, located on both sides, discards it, but I'm not sure how to make it work.
I just want to: dev.example.edu/test/index.php/test* rewrite: dev.example.edu/test/*
thank
You need to exclude the destination path to avoid infinite recursion:
RewriteCond %{HTTP_HOST} ^(.*)dev\.example\.com$ [NC]
RewriteCond $1 !^/index\.php/test/
RewriteRule ^/test/(.*)$ http://dev.example.com/test/index.php/test/$1 [NC]
($1) ^/index\.php/test/.
/test/index.php/test/β¦ /test/β¦, :
RewriteCond %{HTTP_HOST} ^(.*)dev\.example\.com$ [NC]
RewriteRule ^/index\.php/test/(.*)$ http://dev.example.com/test/$1 [NC]
webmasterworld (!)
" [P] URL-, HTTP- . , , , , , HTTP , , .
, , , , URL- http://dev.example.edu/distribution/ , script /distribution/index.php/distribution/"
RewriteEngine on
#
# Return 403-Forbidden response to TRACE requests
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]
#
# Internally rewrite requests for URL-path /recreation/<anything>
# to filepath /eel/index.php/recreation/<anything>
RewriteCond %{HTTP_HOST} ^dev\.example\.edu [NC]
RewriteRule ^/recreation/(.*)$ /ee1/index.php/recreation/$1 [L]
#
# Internally rewrite requests for URL-path /distribution/<anything>
# to filepath /distribution/index.php/distribution/<anything>
RewriteCond %{HTTP_HOST} ^dev\.example\.edu [NC]
RewriteRule ^/distribution/(.*)$ /distribution/index.php/distribution/$1 [L]
, , . P rewriterule.