Typo3 v10 site configuration with a www-subdomain - typo3

I created a site configuration in Typo3 10.4.11 for the entry point www.example.com. When browsing to example.com (without www), I get an error message:
Page Not Found The page did not exist or was inaccessible. Reason: No
site configuration found.
I tried to create a static route, which didnĀ“t work. Any other ideas how to redirect to the original page from www.example.com as well as example.com?

If you're running on Apache, I'd suggest to add a redirect to your .htaccess file:
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
Put the snippet near to the line with RewriteEngine On.

If you want to have both domains served by TYPO3, then the EXT: host_variants may be an option.
https://github.com/b13/host_variants

Related

301 redirect htaccess and Nginx settings issues and .composer folder

I've had some hit and miss results setting up htaccess to forward on a couple of aged domains I acquired to my main site. I wouldn't describe myself as advanced more an enthusiastic intermediate so a nudge in the right direction would be greatly appreciated. I've checked answers but nothing definitive that I can see that relates to my specific issue and the composer folder. In Apache/Nginx I have in directives (http/https)
RewriteEngine On
ErrorDocument 404 https://my-main-site.com/my-page-or-blog-post/
I have 'Restrict the ability to follow symbolic links' unchecked as I have reference to symlinks in htaccess and so avoids a 500 error. I also have put up a static html page so if anyone hits the old aged domain it's not an automatic redirect they'll see the static HTML page with reference to the old/aged domain. So the 301 is sort of in the background but I'm getting a 302 result. My htaccess looks like this......
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^old-site-aged-domain.com$ [NC]
RewriteRule ^(.*)$ https://my-main-site.com/my-page-or-blog-post/ [R=301,L]
However when I go in to AHREFS and look at the backlink data it's showing a 302, however it does confirm http>https is working fine.
http://www.old-site-aged-domain.com/info-page.html
301
https://www.old-site-aged-domain.com/info-page.html
302
https://my-main-site.com/my-page-or-blog-post/
In my site root I also have .composer folder (as well as error_docs, .ssh, httpdocs, logs, .revisium_antivirus_cache), I'm sort of aware what the purpose of this is (PHP) but there are 2 further htaccess files in there, the second smaller htaccess file only has 'deny from all' as content. I wonder if this folder with these 2 htaccess files is presenting a problem/conflict i.e. 3 x htaccess files. The smaller htaccess file is in .composer/cache. The larger htaccess file is in .composer. Should I delete these 2 x htaccess files in .composer folder.
Thanks in advance for any help
James
rewrote htaccess on numerous occasions but without success

Laravel RESTful Routes: Multiple apps with one backend 404

I am somewhat new to Laravel, and recently I got a setup at work to function exactly as I wanted. I have a single installation of Laravel with a subdirectory of apps that all use that same backend as a RESTful master.
The issue I'm having is that when I'm home, I've cloned this repo and changed the db settings to match my localhost at home (instead of at work). However, each time I try to load a rout for a resource I get 404'd!
Here's some code.
app/routes.php:
Route::get('/', function()
{
return 'fgh';
});
Route::any('config', function() {
return 'GET config';
});
//Main Rest Controller
Route::resource('main', 'MainController');
// Route::resource('config', 'ConfigController');
Route::resource('data', 'DataController');
The folder structure is:
|-- appREST (where Laravel is)
|-- shared
|-- apps (where the apps are)
What I am trying to do (which I do at work) is simply make an AJAX call from an app in the apps/ directory, but to a relative path that is adjusted for where appREST is.
At work, I AJAX to '../../../appREST/public/config', or ../public/main or whatever. However, for some reason, this fails at home. The same tables exist in both databases at work, and both are up and functioning (no one else has issues on either). It seems almost as if some local Apache or other setting on just my machine is failing?
I can load the first route for REST (Route::get('/')) in the browser, and 'fgh' IS displayed. However, even after changing to GET config and a string any call either AJAX or browser to any route but '/' 404s.
Also, as a note, in the meantime the applications themselves work fine. If I load static/hard data instead of what I'm trying to load, there are zero problems. This appears to be isolated to my routing in Laravel/Apache.
EDIT
I forgot to include the HTACCESS file for the /appREST/public folder. Here it is:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
NOTE
The setup is a git repo and I actually have this on two separate machines. On the original machine, where the repo starrted as a working directory, the above code works fine. It is only on my home, clonedTo machine that the routes fail.
Does anyone have any ideas or suggestions?
Thank you!
The only way I eventually fixed this was a clean reinstall of both XAMPP and Laravel.
Given that I could find the '/' route and the errors were 404s, I'm going to tentatively call this an Apache error.
So, for anyone else having this issue: I suggest you check your XAMPP/web server settings if your Laravel routes 404!

PrestaShop: non-www URLs redirecting to 404 error page

I am experiencing a weird issue on my PrestaShop website.
When I am opening an URL without WWW on it, it redirects to the WWW page, but displays 404 page.
for example, when I am trying to access http://mydomain.com/home/contact-us it takes me to http://www.mydomain.com/home/contact-us?controller=404. It should not add ?controller=404 to the end of the url. Why it's doing this and how to fix this issue?
You need to manually edit the .htaccess file of your Prestashop website. You can redirect all non-www urls to add www using this code.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Place the code on top of your .htaccess file or within the condition block for checking mod_rewrite
you can set your url under "Preferences > SEO & URLs". you have to change the options "Shop domain" and "SSL domain" there you can set with or without "WWW".
This is most probably cased by not-generated .htaccess file. Go to BackOffice -> Preferences -> SEO & URLs and click [Save]. This will regenerate your .htaccess file.

redirect 301 all pages that doesn't exist to a new directory

i had build another website in the directory http://www.example.com/newwebsite/
Now all the old pages that doesn't exist on the website i want to redirect them to http://www.example.com/newwebsite/
I have a lot of pages in google webmaster with 404 error , that i want to resolve it. I understand that a 301 redirect will resolve my problem.
Can you help me with the htaccess to redirect the pages that doesn't exist any more?
thank you
Try this:
RewriteEngine On
RewriteCond !%{REQUEST_URI} ^/newwebsite/
RewriteRule (.*) /newwebsite/$1 [R=301,L]

bbPress Forum - rewrite to wwww.mysite prohibits login

I am using bbPress installation without WordPress integration.
The redirect of the RewriteEngine at the forum site works:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^forum.mysite.com$
RewriteRule (.*)$ http://www.forum.mysite.com/$1 [R=301,L]
The problem is the login into ppPress.
bbPress login does not recognize: http://www.forum.mysite/bb-login.php.
It redirects to: http://forum.mysite.com/bb-login.php.
I tried permalink settings none and name based, same issue.
Does anyone uses redirect in bbPress or how can I eliminate "double" content and redirect permanently to www.?
I redirected from www.forum.mysite.com to forum.mysite.com and achieved to eliminate "double" content.