skip to Main Content

So i have the following problem: When i use https://www.example.com as the domain, i get the content but when i use https://example.com i get the generic TYPO3 404 error page.

I tried setting up a redirect with example.com and .* as the source path and my starting page as the target and i also tried setting up baseVariants in the site config.
Its a bit strange that my normal base is just example.com and not www.example.com but www.example.com is the one that is working while the other one just gives a 404.

I need to reliable have https://example.com and https://example.com configured to get the same page.

I use TYPO v12.4.14 on an Ubuntu 22.04.4 with an Apache Webserver and PHP 8.1

This is what i tried with the redirects. But that does not work because the regular expression has no delimiters. At least that is what i learned in the time since i made this post initially.

Edit 2:
I tried to make 2 vhosts to redirect example.com to www.example.com. Here are my config files:
File 1 example.conf:

<VirtualHost *:80>

    ServerName example.com
    ServerAdmin [email protected]
    Redirect permanent / https://www.example.com

</VirtualHost>

File 2 example-ssl.conf

<VirtualHost *:443>

    ServerName example.com
    ServerAdmin [email protected]
    Redirect permanent / https://www.example.com

</VirtualHost>

Now it works for http:// example. com but not for https:// example. com

(Needed to add whitespaces bc i am a new member and cant post to many links)

2

Answers


  1. In general that would lead to duplicate content. It’s more advisable to redirect one variant to the other with your server configuration, for
    example using the an redirect in the .htaccess file for apache2 or a
    similar configuration for ngnix or other webservers.

    Redirecting a domain not covered by one of the siteconfiguration was broken
    and a corresponding fix recently merged – albeit not being released yet.
    I guess, with that change a redired within ext:redirects should be possible,
    see [1]

    Beside that, it’s not really clear what your configuration is. I would suggest to use the www.example.com variant as base url (configure a domain, not only a path).

    It would be interesting how exactly you created the redirects record, with option selected and entered for all fields. The given cryptic part information does not help to eloborate what you have configured – and thus making it impossible to prober help on that exactly.

    Login or Signup to reply.
  2. Just add this rule to you :443 configuration =>

    # Force www in URI 
    <IfModule mod_rewrite.c>
      RewriteCond %{HTTP_HOST} ^example.com$ [NC]
        RewriteCond %{HTTP_HOST} !^www. [NC]
        RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    </IfModule>
    

    it checks if the host is without www and your domain and if then it redirects to http://www.example.com. Because this is server side, your 404 error should disappear.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search