.htaccess redirect help

Get help with installation and running phpBB 3.2.x here. Please do not post bug reports, feature requests, or extension related questions here.
Post Reply
User avatar
Curmudgeon
Registered User
Posts: 66
Joined: Thu Jun 14, 2012 9:51 am

.htaccess redirect help

Post by Curmudgeon » Mon Jan 14, 2019 9:48 pm

I'm having difficulty puzzling out the exact syntax/code I need to put into the .htaccess file to have it redirect urls in use to the now secure url.

I had Bluehost set me up with Comodo SSL recently for my site.

I want to setup my .htaccess file to redirect all unsecure previous used urls for it to the new secure url:

http://mobtalk.org
http://mobtalk.org/board

The current file
# Use PHP56 Single php.ini as default
Redirect /index.php http://mobtalk.org/board/
AddHandler application/x-httpd-php56s .php


RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
My attempts so far have had me running in broken circles.

This file was originally created to redirect http://mobtalk.net to the .org site

User avatar
</Solidjeuh>
Registered User
Posts: 1224
Joined: Tue Mar 29, 2016 3:45 am
Location: Aalst (Belgium)
Name: Andy Dm
Contact:

Re: .htaccess redirect help

Post by </Solidjeuh> » Mon Jan 14, 2019 9:55 pm

search:

Code: Select all

<IfModule mod_rewrite.c>
RewriteEngine on
Replace with:

Code: Select all

<IfModule mod_rewrite.c>
RewriteEngine on
# First rewrite to HTTPS:  # regel niet uitvoeren wanneer verbonden via https
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
We offer fun HTML5 games for young and old.
Register a free account & enjoy all functions!
Save your score, challenge other members or play along with our tournaments.


~~~ https://www.solidjeuh.be ~~~

janus_zonstraal
Registered User
Posts: 2919
Joined: Sat Aug 30, 2014 1:30 pm

Re: .htaccess redirect help

Post by janus_zonstraal » Mon Jan 14, 2019 10:02 pm

For non www try

Code: Select all

RewriteEngine on

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Sorry! My English is bat ;) !!!

User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 2856
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: .htaccess redirect help

Post by thecoalman » Tue Jan 15, 2019 12:34 am

Curmudgeon wrote:
Mon Jan 14, 2019 9:48 pm
My attempts so far have had me running in broken circles.
Browsers cache a 301 redirect, whenever you are implementing one leave out the:

Code: Select all

R=301
Once you have tested it and know it;s working properly then add it.

Try what </Solidjeuh> posted and then deal with the .net to .org redirect.

Post Reply

Return to “[3.2.x] Support Forum”

Who is online

Users browsing this forum: Bermudez, Crizzo, invenio, janus_zonstraal, profKroy, stevemaury and 42 guests