.htaccess 문제를 해결하려고 합니다.
내 .htaccess에 이 줄이 있지만 사이트에는 여전히 "슬래시 포함" 버전이 있습니다.
죄송합니다. 포르노 페이지입니다.
https://carlamila.es/acompanantes-madrid.php/
미리 감사드립니다! ! !
#With www to nonwww
<IfModule mod_rewrite.c>
RewriteCond %{HTTP_HOST} ^www.carlamila.es [NC]
RewriteRule (.*) https://carlamila.es/$1 [R=301,L,QSA]
</IfModule>
#Http to HTTPS
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} off
RewriteRule (.*) https://carlamila.es/$1 [R=301,L,QSA]
</IfModule>
#With to without slash
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule (.*) http://carlamila.es/$1/ [R=301,L,QSA]
</IfModule>
답변1
지금은 잘 작동합니다.
<IfModule mod_rewrite.c>
RewriteEngine On
#Quitar el .php
RewriteCond %{THE_REQUEST} /([^.]+)\.php [NC]
RewriteRule ^ /%1 [NC,L,R]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [NC,L]
#De http a https
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#De www a sin www
RewriteCond %{HTTP_HOST} ^www.carlamila.es [NC]
RewriteRule ^(.*)$ http://carlamila.es/$1 [L,R=301]
#De barra a sin barra
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
ErrorDocument 404 /404.php
</IfModule>