Tag Info

Hot answers tagged

2

[DPI] (discardpathinfo) After hours of tests and puzzlement, I went back to the documentation and found the solution: the [DPI] flag. The DPI flag causes the PATH_INFO portion of the rewritten URI to be discarded. This flag is available in version 2.2.12 and later. In per-directory context, the URI each RewriteRule compares against is the ...


2

Try this <VirtualHost *:80> ServerName example.com ProxyPass / http://1.example.com:8888/ ProxyPassReverse / http://1.example.com:8888/ RewriteEngine On # RewriteLog /tmp/rewrite.log RewriteBase / RewriteCond %{HTTP_HOST} !^example.com$ RewriteRule !^/(.) ...


2

You are very close to the right format. Try changing the last part of the last line from &q=%1 [L,R=301] to &q=$1 [L,R=301]


1

I am assuming that you want to proxy all requests to the other host you are using in the proxy configuration. Therefore you should combine both tasks into a single set of directives like so: <VirtualHost *:80> ServerName example.com RewriteEngine On RewriteCond %{REQUEST_URI} !^/(.+/)faces/main.jsf RewriteRule ...


1

<VirtualHost *:80> ServerName example.com RewriteEngine On RewriteRule ^/user1/(.*) http://1.example.com:8888/user1/faces/main.jsf$1 [L,P] RewriteRule ^/user1(.*) http://1.example.com:8888/user1/faces/main.jsf$1 [L,P] RewriteRule ^/(.*) http://1.example.com:8888/$1 [L,P] </VirtualHost> eg: http://example.com/user2 --> ...


1

This should work for a first level directory with alphanumeric characters. <VirtualHost *:80> ServerName example.com ProxyPass / http://1.example.com:8888/ ProxyPassReverse / http://1.example.com:8888/ RewriteEngine On # RewriteLog /tmp/rewrite.log RewriteCond %{HTTP_HOST} ...


1

You asked what's wrong with your rewrite rules. Look at these two lines in your configuration: RewriteCond %{REQUEST_URI} !^/(.+/)faces/main.jsf.* RewriteRule !^(.+)/faces/main.jsf.*$ $1/faces/main.jsf [L,R] Your RewriteCond rule will match if the url doesn't already have the faces/main.jsf bit. That looks fine. Your RewriteRule should not then be ...


1

I would not use Redirect statement to do that, but only RewriteRule. Something like that should work: RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)?A\.com [NC] RewriteRule ^$ http://www.B.com [NC,R=301] RewriteRule ^([^/]+)(.*)$ http://$1.B.com$2 [NC,R=301]


1

You should be able to add more patterns: RedirectMatch 403 /(\{\$itemURL\}|cro|HNAP1|wp|blog|wp/wp-admin|blog/wp-admin|wp/wp-admin/.+|)/?$ Hope this helps.


1

You do not have to specify RewriteCond if you could specify the match in RewriteRule. For example: # /xx/somepage.php -> /somepage.php?ln=xx INTERNAL REWRITE RewriteCond %{REQUEST_URI} ^/../.+ [NC] RewriteRule ^(en|de)/(.*) $2?ln=$1&%{QUERY_STRING} [L] Should work with just: # /xx/somepage.php -> ...



Only top voted, non community-wiki answers of a minimum length are eligible