I have a centOS machine where there is a website with dynamic pages running on Tomcat (port 8080) and I have installed Apache server on the same machine (port 80) with a load balancer in front of this machine (port 80).
In the httpd.config for the directory I have this settings:
DocumentRoot "/var/www/html"
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
RewriteEngine On
RewriteRule ^my-old-page$ /en-GB/Shop [R,L]
RewriteRule "^/en-US/foo\.html$" "/en-US/Shop.html" [PT]
Redirect "/en-US/foo1.html" "/en-US/Shop.html"
</Directory>
And I have added a file called .htaccess under /var/www/html containing only:
RewriteRule ^my-old-page$ /en/my-new [R,L]
And after that I have restarted apache
service httpd restart
However it does not work?
What am I doing wrong?
You do not have the RewriteEngine
directive in neither your configuration file nor the .htaccess
.
Per the Documentation , no rewrite processing is done unless the RewriteEngine
is set to On
.
It would benefit you to read the official guide and select the best scenario. You may note that all their examples include the RewriteEngine On
directive. You may also consider using the much simpler Redirect
directive.
Well the solution depends on what you really need. The easier , but not the best way it's using "mod_proxy_ajp".
in your http.conf active the following modules:
and add the following:
ProxyRequests Off
<Proxy *>
Order deny,allow
Deny from all
Allow from localhost
</Proxy>
ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/
this configuration tells the apache(httpd) proxy all the request to and special port in tomcat that its by default configured in servers.xml
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.