Hot answers tagged mod-rewrite
It doesn't seem that you want to access anything outside of the /public folder? If so, this seems easy to me, and without any rewrites (I hope there isn't any reason you actually want to use mod_rewrite!) Put index.php in the public folder Set the DocumentRoot to be the public folder Use ErrorDocument to redirect any file not found to index.php If you ...
I would implement these kind of redirects in the application code itself, creating an array with source and destination URLs, and then testing if the URL contains params in the array, send back a redirect to destination. Using rewrite rules for this is a bit complicated way to implement this.
Your use-case is the text-book example of when to completely avoid rewrite rules. To redirect http URLs to https, simply do the following: <VirtualHost *:80> ServerName www.example.com Redirect "/" "https://www.example.com/" </VirtualHost> <VirtualHost *:443> ServerName www.example.com # ... SSL configuration goes here ...
You will need to have an active vhost serving the domain you want to redirect, even if not in use. It will work absolutely fine in the httpd.conf file, Apache is set to read from all *.conf files.
From what I'm reading, you would need two separate VirtualHost entries, one for HTTP, and one for HTTPS. These are different by the port (:80 for HTTP and :443 for HTTPS), and also because you have the SSL On section for HTTPS. Each would need to have all names listed: ServerName beta.example.com ServerAlias example.com www.example.com Then, you would ...
You might want try appending a trailing slash / to the ProxyPass target URL's i.e. change ProxyPassReverse http://127.0.0.1:8080 into ProxyPassReverse http://127.0.0.1:8080/ since you're applying those directives to a path that also terminates with a trailing slash / (or only a slash in this case: <Location />) as the manual warns: ...
Only top voted, non community-wiki answers of a minimum length are eligible