Today after installed PolyLang plugin,my wordpress site has a issue:
err_too_many_redirects
so I followed some tutorials to midfield the .htaccess file in cPanel:
before:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
RewriteRule ^$ https://www.ohyanlawgroup.com/home/ [L,R=301]
RewriteEngine On
# RewriteCond %{HTTPS} off
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.ohyanlawgroup.com/$1 [R,L]
after:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule ^(.*)$ https://www.ohyanlawgroup.com/ [L,R=301]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.ohyanlawgroup.com/$1 [R,L]
Now the err_too_many_redirects gone.
But the website can only load part of its content, it seems all the static file has not been loaded.
Any friend can help?
Related
I want redirect augias.eu to subdirectory augias.eu/fr.
Redirection is working fine but all the urls like augias.eu/fr/path are redirected to augias.eu/fr
I don't get it. The website is live.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^augias.eu [NC,OR]
RewriteCond %{HTTP_HOST} ^www.augias.eu [NC]
RewriteRule ^(.*)$ https://augias.eu/fr/$1 [L,R=301,NC]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
HTacces file of the /fr directory
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
In the main directory .htaccess file change this RewriteRule:
RewriteRule ^(.*)$ https://augias.eu/fr/ [L,R=301,NC]
to this one:
RewriteRule ^(.*)$ https://augias.eu/fr/$1 [L,R=301,NC]
because $1 represents the first value enclosed in (). In this case match this expression (.*).
And inside the /fr/ folder, edit or create a new .htaccess file with this content:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /fr/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /fr/index.php [L]
</IfModule>
# END WordPress
# Redirect HTTP to HTTPS
RewriteCond %{HTTPS} !=on RewriteRule (.*)
https://%{SERVER_NAME}/$1 [R,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On RewriteBase /blog/ RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress
This is my websites htaccess code. I want to redirect my site http to https.I tried some code but not working
Use the following code if your site in root of the server.
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
OR
assuming from your code its in /blog/ folder. Using the following code instead.
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
I have a website made with wordpress https://example.es/ and I'd like to remove the final slash.
My .htaccess looks like this:
RewriteCond %{REQUEST_URI} !wp-admin
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.es$ [NC]
RewriteCond %{REQUEST_URI} jh73820h.htm$ [NC]
RewriteRule .* - [L]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://example.es/$1 [R=301,L,QSA]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
I found this code and it removes the final slash but it appears a 404 error.
Options +FollowSymlinks
RewriteCond %{REQUEST_URI} !wp-admin
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.es$ [NC]
RewriteCond %{REQUEST_URI} jh73820h.htm$ [NC]
RewriteRule .* - [L]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://example.es/$1 [R=301,L,QSA]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)/$ https://www.example.es/$1 [R=301,L,QSA]
</IfModule>
# END WordPress
Does anybody know what can I do not to get a 404 error?
Try this:
// BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule (.+)/$ $1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
I try to Redirect from old domain to new domain, By below code, but not work, Where is error.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$
RewriteRule ^/?$ "http\:\/\/mydomain\.com\/" [R=301,L]
</IfModule>
# END WordPress
You need to place redirect rule before WP catch-all rule otherwise you will only get index.php after redirect on new domain:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteRule ^ http://newdomain.com%{REQUEST_URI} [NE,R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
I have been looking all around the web but can't find a clean solution.
Im not an hero in .htaccess rules but i would love to have some rules that will force the user to https and non-www for all the domains on that server / installation.
Atm i got this but im stuck;
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
</IfModule>
Try this code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,R=301,L]
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [NE,R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Also make sure WP permalink has https and non-www URL in site and home URLs.