skip to Main Content

Ok, I’m a newbie… first time asking things here.
I have a domain called example.com
All my website is at the following URL: https://example.com/example.com/inter/pf2/
What I want is the following:
When a user goes to https://example.com show all the content at https://example.com/example.com/inter/pf2/ but the URL keep saying example.com
I’ve tried the following:

RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^$ /example.com/inter/pf2/ [L]

But it is not working

EDIT:

This is the .htaccess:

RewriteEngine on

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php74” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

RewriteRule ^/?$ %{HTTP_HOST}/inter/pf2/ [L]

2

Answers


  1. With your shown samples, could you please try following. Please clear your browser cache before testing your URLs.

    RewriteEngine ON 
    RewriteCond %{REQUEST_URI} !^/example.com/inter/pf2 [NC]
    RewriteRule ^(.*)/?$ %{HTTP_HOST}/inter/pf2/$1 [L]
    
    Login or Signup to reply.
  2. This line:

    RewriteCond %{HTTPS} !=on
    

    Means "if HTTPS is not switched on". In other words "only run the rule if connecting over plain "http://&quot;.

    But your example shows you trying to access an "https://&quot; URL.

    You probably just don’t need that condition, but if you were trying to say "if HTTPS is switched on", you need = not !=:

    RewriteCond %{HTTPS} =on
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search