TYPO3 links from non-https to http - .htaccess

Goal: Every non-https link has to become https. Always.
Achieved by now:
Changed base-url to https
Each link is https IF I'm on non-http
My issue is stated at my second achievement. For some reasons the links targets to https if I am on a non-https page, otherwise to http. I know I could implement a work-around using .htaccess but this isn't the clean way and I want to implement it in a clean way.
What I've done to fix it:
I know one can force the protocoll for a single typo3 page and I can update all pages via database but in this case it's not possible as it's a multitree presentation and not every tree have to use https.
I also googled and read about config.baseUrl but I've changed that before I even googled.
On the presentation "Enforce https" having key "https" is installed but I can't find it in the Ext. Repository.
Further stuff:
I guess the issue is not caused by .htaccess but in any case: This in my .htaccess file
RewriteCond %{HTTP_HOST} ^mydomain\.de$
RewriteRule (.*) https://www.mydomain.de/$1 [R=301,L]
Any help is appreciated.

Solution
The solution is to deactivate the Extension "https" which is installed in the TYPO3 presentation. Why? Well, for some reasons the extension replaces/renders the urls as absolute and which is even more weird with "http".
I proceed with the investigation and update the post later on with in depth details.

Related

HTACCESS: Redirect all the requests to another page, in place of index, hiding arguments?

I expose here my issue, I hope to explain myself clearly and correctly. In case of any specification, please ask me.
What I need is to redirect all the request (except the one to index.php) to another .php file, without the necessity to specify an argument.
here an example of what I need to do:
http://www.example.com -> shows index.php
but:
http://www.example.com/songs/title-of-the-song
should call the page: songs.php?dir=title-of-the-song of course without showin to the user the string "songs.php?dir=title-of-the-song" but just the URL
http://www.example.com/songs/title-of-the-song
It's what occurs with Drupal, but i'm not using that CMS for my site.
You are probably looking for something like that:
RewriteEngine on
RewriteRule ^/songs/(.+)$ /songs.php?dir=$1 [L]
Note: this is the version for the http host configuration. For usage in .htaccess style files you have to adapt it slightly. But if you have access to the host configuration you should always prefer that over .htaccess style files. Those files require an additional module, are notoriously error prone, hard to troubleshoot and really slow the server down.

forcing ssl for all embedded links using htaccess to tackle insecure content

I am trying to enforce SSL on a folder (blog admin). That part is fine - all pages are SSL, but the site is generating error messages for insecure contents on the page. I can go after all those links individually, to enforce SSL on the links.
I was wondering if that could be done through htaccess alone?
This is what I have done for SSL enforcing on the admin folder:
#forcing https for admin folder
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} admin
RewriteRule ^(.*)$ https://mysite.com/blog/admin/$1 [R,L]
How can I convert all the non ssl links to ssl on the same page ?
Addition:
1) I am using wordpress 3.6 with different plugins that come along with it. Only the admin areas is SSL, and the rest of it, other than login page (that is outside of admin is also SSL) are non SSL (for example the Blog feed for the end users).
2) A few of insecure contents are coming from my own site, but then there are others which are coming from the plugins I am using. For example disqus commenting system, and flickr.
3) I can force the internal links for images, css, and jscript by simply using 'setting for permalink' on wordpress (noticed the url was provided as http and not https). Similarly, I can locate and fix the other links like this one:
The page at https://mysite.com/blog/wp-login.php ran insecure content
from
http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?ver=3.6
4) The issue is:
If I use permalink setting, then the blog links are created as https
instead of http, and that breaks the plugins I am using for the non
SSL pages, for example disqus comment feed don't show up on the blog
page. Secondly, The painful process of fixing all the non ssl links.
Also, I can always miss out on some of them, since I am doing it
manually. It would be really helpful, if I could enforce SSL for all
these non SSL links using htaccess, perhaps the only easy solution.
Rewrite rules (which are in in fact redirections, when it's about HTTP to HTTPS) won't help, since by the time the initial plain HTTP request reaches the server, it's too late.
It's the links on the page you serve that must be addressed. This is generally up to the application (e.g. your PHP/CGI applcation) running on the server, not up to the server itself. The server would need to be able to process the content of the responses it sends to replace these links, not just redirect the requests (like mod_rewrite does).
mod_proxy_html (distributed with Apache 2.4 or separately in earlier versions) is a module that can to in-depth processing of the response, but I'm not sure whether it can be used as a post-processing tool for PHP running on the same server, to rewrite the links it sends.
Of course, this won't fix links to external resources that are not available via https:// anyway.

.htaccess - Masking and redirecting to a subdirectory on a different server

I'm looking for some help with my .htaccess file.
In short, I have a bunch of content up in the subdirectory www.myserver.com/forum/ (this directory is not my choice and cannot be changed), which includes both a forum (myserver.com/forum/forum) and a wiki (myserver.com/forum/wiki) and this is abviously not an ideal layout. I do not own myserver.com and there is content there that is not mine, though I have full access to the entire server.
I also have a domain name www.mydomain.com, which I want to redirect and mask such that if a user goes to mydomain.com/<something> they will be shown the content from myserver.com/forum/<something> while still being shown mydomain.com/<something> in the address bar.
One other thing I'd like to see, although it isn't vital, would by for a 404 generated by someone typing in mydomain.com/somethingThatDoesNotExist should redirect to mydomain.com/404.php instead of myserver.com's default 404.
I've tried a number of different approaches and searched extensively for the past day or so online - I'm sure that the answer is even here on SO somewhere, but all of the guides/examples I've tried have not worked and I feel like I'm going in circles.
Many thanks in advance.
EDIT: And I do know for sure that .htaceess is enabled.
if a user goes to mydomain.com/ they will be shown the
content from myserver.com/forum/ while still being shown
mydomain.com/ in the address bar.
First thing you need to understand that this is ONLY possible if mod_proxy is enabled on the Apache server of mydomain.com.
Once you've enabled mod_proxy, mod_rewrite and .htaccess through httpd.conf on mydomain.com, put this code in its .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteRule ^(.*)$ http://myserver.com/$1 [L,P]
I will have to think little more about your 404 requirement, but if you get this working I am sure we can find a workaround for that as well.
You could do some proxying with PHP or whatever other language they allow..
Take a look at file_get_contents behind a proxy?

Url duplication with Prestashop SEO

I have an e-commerce developed with the CMS Prestashop.
Yesterday i have seen in my Webmaster Tools that i had some duplicated URL, like this:
www.mysite.com/manufacturers
www.mysite.com/it/manufacturers.
Where 'it' is the suffix of the default and only language for the website.
I've already activate the friendly URL in the back-office and also I've a .htaccess file generated automatically by the generator in the back-office.
What should I do to fix this issue?
PS: Also I think that I've already taken a penalization from googlebot.
First of all let me clarify the Title from the SEO point of view. The problem is from Prestashop side not from SEO side. It is just affecting your SEO.
Now on the problem, Prestashop is notorious for URL problems. I would not recommend you the .htaccess hack solution because every time you regenerate your .htaccess from you backend, you have to manually insert that hack again in it to keep the problem down. And suppose this url problem arises again after sometime for some other url than you have to do it again. It can turn into a nightmare.
So here are some of my personal recommendations...
If this site is critical(which I am assuming), buy a Prestashop url rewriting module from a trusted provider. You will also get a technical support in case this problem arises again in future.
If you can't buy than I would suggest you to ask this question on Prestashop forums, as this is Prestashop specific, to permanently solve this problem. You will most likely to get more instant answers as you will find more people working on Prestashop there than here.
Somewhere either in the htaccess file in your document root, or in the vhost/server config for mysite.com, you'll need to 301 redirect. Now you just need to choose which one you want to keep, the one with /it/ in front or the one without? Let's say you want to point everything to the one without, you'll use one of these:
Using mod_alias:
Redirect 301 /it/manufacturers /manufacturers
Using mod_rewrite:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?mysite.com$ [NC]
RewriteRule ^/?it/manufacturers(.*)$ /manufacturers$1 [L,R=301]

Domain redirect Problem

I have a website say domain.old hosted with say 'host-old'
I want to do away with 'host-old' and go with 'host-new'
(so effectively 'host-old' hosting would end)
Also I want a new domain - say 'domain.new'
So now I have 'domain.old' , 'domain.new' and 'host-new' with me
Now I want all my old links are preserved:
viz. http://domain.old/cat1/link1/page1/
redirects to http://domain.new/cat1/link1/page1/
Now please advice what would be the best way to go to set up with the new host.
This is a multi-step process:
Create all the pages at 'host-new' so that 'http://domain.new/cat1/link1/page1/' all work.
Enable mod_rewrite in Apache on 'host-new', and configure as below.
Change the dns entries for 'domain.old' to point to 'host.new'
wait 2-3 days for dns entries to propagate to remainder of the internet.
stop hosting at 'host-old'
The mod_rewrite config you need is:
LoadModule rewrite_module modules/mod_rewrite.so
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.old$
RewriteRule ^(.*)$ http://domain.new/$1 [NE,R=301,L]
i don't know exactly how this would work but you could parse the URL from the old site and redirect to your new host. You need a common script in your domain.old masterpage that does this for you.
The question would be easier to answer if you specified your platform. If you are on Apache, I'd take a look at mod_rewrite
You'll probably want to provide a 301 (moved permanently) http response.
When you get rid of the old domain, you can't control it any more, and therefore won't get traffic from it. You should transfer the old domain to your new host (not too hard), and then have a redirector running on it - the way other answers suggest.

Resources