Difference between revisions of "Apache Rewrite"
Jump to navigation
Jump to search
Michael.mast (talk | contribs) |
Michael.mast (talk | contribs) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==No Encoding== | ==No Encoding== | ||
− | While working with nextcloud, I ran into a rewrite rule that would not keep slashes as I needed them. This was caused by the slashed being converted in a browser, then someone copying the converted URL as a link in another site. | + | <ref>https://httpd.apache.org/docs/current/rewrite/flags.html</ref>While working with nextcloud, I ran into a rewrite rule that would not keep slashes as I needed them. This was caused by the slashed being converted in a browser, then someone copying the converted URL as a link in another site. |
<br> | <br> | ||
<br> | <br> | ||
<ref>http://tkurek.blogspot.com/2013/06/252f-instead-of-2f-in-url-apache.html</ref> I was scratching my head as to why %2 was being turned into %252 after a migration from one vhost to | <ref>http://tkurek.blogspot.com/2013/06/252f-instead-of-2f-in-url-apache.html</ref> I was scratching my head as to why %2 was being turned into %252 after a migration from one vhost to | ||
another. Found out I needed to add [NE] to the rewrite rule in order for the slashed to be registered correctly. | another. Found out I needed to add [NE] to the rewrite rule in order for the slashed to be registered correctly. | ||
+ | <br> | ||
+ | <pre> | ||
+ | <VirtualHost *:80> | ||
+ | RewriteEngine On | ||
+ | RewriteCond %{HTTPS} off | ||
+ | RewriteRule ^/(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [NE] | ||
+ | </VirtualHost> | ||
+ | </pre> |
Latest revision as of 12:55, 15 April 2019
No Encoding
[1]While working with nextcloud, I ran into a rewrite rule that would not keep slashes as I needed them. This was caused by the slashed being converted in a browser, then someone copying the converted URL as a link in another site.
[2] I was scratching my head as to why %2 was being turned into %252 after a migration from one vhost to
another. Found out I needed to add [NE] to the rewrite rule in order for the slashed to be registered correctly.
<VirtualHost *:80> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^/(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [NE] </VirtualHost>