Results 1 to 3 of 3

Thread: How to redirect specific pages or folder from http to https

  1. #1
    Join Date
    May 2013
    Beans
    1

    How to redirect specific pages or folder from http to https

    Hello All,

    I want to redirect specific pages or folder from http to https not whole site..

    I am using ubuntu 12.04LTS... please explain me.

    I am using .htaccess file for support the apache2.

  2. #2
    Join Date
    Nov 2008
    Location
    Sheffield, UK
    Beans
    1,514
    Distro
    Ubuntu

    Re: How to redirect specific pages or folder from http to https


  3. #3
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    mod_rewrite

    Welcome to the forums.

    If you have access to Apache2's configuration files in /etc/apache2/sites-enabled/ then you don't have to mess with .htaccess. The file .htaccess is used only in occasions you aren't able to change the configuration file directly. When you change the configuration file, you have the advantage that all the changes are in the same place.

    That said, the way to change the configuration file is to use the module rewrite. First turn on the module if it is not already on.

    Code:
    sudo a2enmod rewrite
    sudo service apache2 restart
    Then you can make your changes to your configuration file. The changes go in between the <VirtualHost> tags to apply to the whole site, or between <Directory> tags to apply to a certain directory.

    Code:
    RewriteEngine on
    Redirect /old.html /new.html

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •