Support » Fixing WordPress » http to specific URL using htaccess in WordPress

  • sktrader


    I am looking for help with the htaccess redirect rules.

    I have url and I want the following redirection => =>

    I found the following .htaccess rules but its not working for me

    RewriteEngine On
    RewriteCond %{HTTP_HOST} www^example\ [NC]
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%. 
    {HTTP_HOST}%www^ [302 L]

    I will be using the above rule for a WordPress site so do i need to paste the above rules at the bottom so that it doesn’t overruled by other rewrite rule?

    Thanks in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Naveenkumar C


    Hi @sktrader,

    Try this

    # http -> https
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]


    Thread Starter sktrader


    Thank you Naveen for your reply.
    Can I please ask how it would redirect to specific URL?
    Can I specify a URL at https://%{HTTP_HOST}%{REQUEST_URI} if yes then how it will look like?

    Naveenkumar C


    Try this one

    Redirect /page-2/
    Moderator Jan Dembowski


    Forum Moderator and Brute Squad

    Moved to Fixing WordPress, this is not a Developing with WordPress topic.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘http to specific URL using htaccess in WordPress’ is closed to new replies.