1

In the .htaccess file i've added this rules to force all users to visit the website under HTTPS.

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteCond %{SERVER_PORT} !^443$
  RewriteCond %{THE_REQUEST} !/(robots\.txt|sitemap\.xml|us_portfolio-sitemap.xml|post-sitemap.xml|page-sitemap.xml)\s [NC]
  RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
  RewriteRule ^index\.php - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
</IfModule>

But when a user try to visit http://example.com/news it will be redirected to https://example.com/?/news. If i call http://example.com/news/ it will be redirected correctly to https://example.com/news/ How i can remove the /?/ from the url so users could be redirected at the right page?

davidev
  • 314
  • 9
  • 22
  • Do you have any other rules or htaccess in the news folder? – Amit Verma Aug 17 '16 at 14:36
  • 1
    Try clearing your browser cache completely and retest as there is no rule shown here to convert `/news` to `?/news` – anubhava Aug 17 '16 at 14:37
  • Those are the only rules related to mod_rewrite. I have others rules for: - mod_deflate.c - mod_headers.c - mod_expires.c - mod_gzip.c But the problem is not in the other rules... – davidev Aug 17 '16 at 14:46
  • You test with [`R=301`](http://stackoverflow.com/a/9204355/1741542), which you should never do. Most likely this weird redirect is some leftover from earlier experiments. – Olaf Dietsche Aug 17 '16 at 14:53
  • Thanks @OlafDietsche for your suggestion. But what about the main problem? – davidev Aug 20 '16 at 08:37
  • I don't know, there is no rule in your question causing such a behaviour. This is why I assumed, this might be from some earlier version. Have you restarted your browser/cleared the cache, and retried? Also the suggestion is replace `R=301` with `R`, and only when you're done and everything works to your satisfaction, you may return to `R=301`. – Olaf Dietsche Aug 20 '16 at 11:15
  • Yes i've try to clear cache, i've also removed the R=301 and now i'm using: RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L] I've also tried some different configuration, but the problem persist :-/ It could be a problem related to Wordpress ? – davidev Aug 21 '16 at 11:18
  • basically if i call http://example.com/news it will redirect me on https://example.com/?/news , BUT if i call http://example.com/news/ it will be redirected in the right page: https://example.com/news/ – davidev Aug 21 '16 at 13:27

0 Answers0