-1

I'm using this htaccess code. I expect any call to be directed to https://www.mysite.com/theme/topic. I've really looked lots of links & helps - the result is only and ever:

https://www.example.com/index.php

so the /theme/topic are not in the output url, only the index.php

what is wrong here? thanks for any help

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteBase /

   ### If file exists, use it.
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l

   RewriteRule ^(.*)$ index.php [L]

   RewriteCond %{HTTP_HOST} !^www\. [NC]
   RewriteRule ^(.*)$ http://www.example.com/$1 [L,QSA,R=301]

   RewriteCond %{HTTPS} off
   RewriteRule ^(.*)$ https://www.example.com/$1 [L,QSA,R=301]
</IfModule>
DaveG
  • 741
  • 6
  • 16
  • 2
    possible duplicate of [http to https trough htaccess](http://stackoverflow.com/questions/10489895/http-to-https-through-htaccess) – Azrael Oct 01 '14 at 14:24
  • I've tried this solution (RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]) too, thank you for the hint. result is the same: only index.php page – Theobald Tiger Oct 01 '14 at 15:08

1 Answers1

0

you say it yourself:

so the /theme/topic are not in the output url, only the index.php

try to change the line

RewriteRule ^(.*)$ index.php [L]

into

RewriteRule ^(.*)$ /theme/topic/$1 [L]

Or is there a specific reason why not to put it there?

[edit after clarification]

So you have 2 dynamic parameters and want to rewrite yourdomain.com/parameter1/parameter2 to yourdomain.com/index.php?p1=parameter1&p2=parameter2? Then try the following:

RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?p1=$1&p2=$2 [L]

[re-edit after more clarification] Oh, so it is just redirecting from http to https and redirecting to www? Then you can just do the following:

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /

 RewriteCond %{HTTP_HOST} !^www\. [NC, OR]
 RewriteCond %{HTTPS} !on
 RewriteRule ^.*$ https://www.mysite.com/%{REQUEST_URI} [R=301,L]
</IfModule>
DaveG
  • 741
  • 6
  • 16
  • yes: whatever theme or topic might be, (they are dynamic) - the redirect should be from http -> whatever uri to https -> whatever uri – Theobald Tiger Oct 01 '14 at 15:12
  • does my edit solved your probled? If so, please mark as solved. – DaveG Oct 03 '14 at 06:08
  • sorry for late answer @DaveG. I'm want to rewrite `http://example.com/parameter1/parameter2/ ... ` to: `https://www.example.com/parameter1/parameter2/ ... ` what I get is: `https://www.example.com/index.php` – Theobald Tiger Oct 06 '14 at 19:32