Converting to SSL with a changed URL structure: order of items in htaccess

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • djbaxter
    Senior Member
    • Aug 2006
    • 1418
    • 4.2.5

    [Forum] Converting to SSL with a changed URL structure: order of items in htaccess

    Continuing with the upgrade of that old forum, the next step is conversion to HTTPS.

    SSL certificate already applied.

    Now, the URL structure has also changed from vBSEO (uninstalled) to Standard vBulletin 4.2.5 Friendly URLs.

    Posts are easy to redirect:

    Code:
    #rewrite old vBSEO urls
    RewriteRule [^/]+/([0-9]+)-[^/]+\.html http://www.politics.ie/showthread.php?t=$1 [L,R=301]
    But then in order not to lose search index links to categories and forums, as well as certain special links, I have a rather large number of Redirect 301 lines similar to this:

    Code:
    Redirect 301 /forum/current-affairs/ http://www.domain.com/forumdisplay.php?26-Current-Affairs
    My question:

    The redirect for http to https and for non-www to www will look something like this (I think this should do both?):

    Code:
    RewriteCond %{HTTP_HOST} ^politics\.ie$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.domain\.com$
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteRule ^\$\/?(.*)$ "https\:\/\/www\.domain\.com\/\$$1" [R=301,L]
    So is it better to use the http to https redirect FIRST before all the Redirect 301 statements?

    Or should the Redirect 301 statements come first, ending with the https to https instructions?
    Psychlinks Web Services Affordable Web Design & Site Management
    Specializing in Small Businesses and vBulletin/Xenforo Forums
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...