• Resolved BigBlack

    (@bigblack)


    I need to redirect all unfound pages for each language. I’ve created a redirect for third domain level en.mysite.it to https://www.mysite.it/en/ Now I need to understand how to redirect each en.mysite.it/page.html page not found, to https://www.mysite.it/en/. This is the code I’m using in htaccess:

    RewriteCond %{HTTP_HOST} ^en\.mysite\.it$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.en\.mysite\.it$
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteRule ^/?$ "https\:\/\/www\.mysite\.it\/en\/" [R=301,L]

    I’ve multiple redirects for each language, so i need to redirect only pages from the subdomain “en” and repeat the code for each language.

Viewing 1 replies (of 1 total)
  • Thread Starter BigBlack

    (@bigblack)

    Solution Founded…
    Need to replace only this ^/?$ with that ^(.*)

    The result:

    RewriteCond %{HTTP_HOST} ^en\.mysite\.it$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.en\.mysite\.it$
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteRule <code>^(.*)</code> "https\:\/\/www\.mysite\.it\/en\/" [R=301,L]
Viewing 1 replies (of 1 total)
  • The topic ‘Redirect all pages to the home’ is closed to new replies.