Home > AI > Server > Apache >

Apache .htaccess

RewriteEngine On

Enables the mod_rewrite module, which is required for URL rewriting.

[P]

[P] flag is for ProxyReverse but it only works for proxying requests to a different URL on the same server. In your case, since you’re trying to redirect to a different port (https://english92.com:3001), this method wouldn’t work.

[L]

Lastly

[R=301]

Permantently

Some examples.

Redirect HTTP to HTTPS

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Redirect http://english92.com to HTTP

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://english92.com:3000/$1 [P,L]

Redirect HTTPS to HTTPS:3001


https://english92.com gets 500 error

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule ^(.*)$ https://english92.com:3001/$1 [P,L]

Leave a Reply