/    Sign up×
Community /Pin to ProfileBookmark

How to change from absolute link paths to relative for SSL

My php website just got SSL installed. I’ve got two related questions. I only want https to kick in after login, not on the landing page. The landing page can stay unprotected.

  • 1. What is the proper code in the .htaccess file for the redirect to https?

  • 2. I believe I need to change all my links from absolute paths, like <a href=”https://webdeveloper.com/dir1/file.php> to relative.
    What is the proper way to do that, using the example? Is it <a href=”/dir1/file.php> or <a href=”dir1/file.php> or <a href=”../../file.php>? Please explain why so I can learn something.
    Kind Regards,
    Leafgreen 😮
  • P.S. Wasn’t sure exactly which category to post this in…

    to post a comment
    PHP

    1 Comments(s)

    Copy linkTweet thisAlerts:
    @scragarFeb 01.2009 — I don't think you should use .htaccess to redirect to https, PHP is more than capable of doing so, and PHP will let you make more advanced data checks.

    It depends entirely on what you want, the leading / is absolute, it always points there, the ones without are relative, where they point changes if you move the directory.
    ×

    Success!

    Help @Leafgreen spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.19,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...