.htaccessとスラッシュの問題

.htaccessとスラッシュの問題

.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>

おすすめ記事