Pare in regula?
![]()
Pare in regula?
![]()
Asa arata o parte din .httaccess-ul actual. Cum trebuie facut ca redirectul de la www catre non-www + http catre https sa fie facut intr-un singur pas? Multumesc!Cod:<IfModule mod_rewrite.c> Options -Indexes RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteRule \.(js|css|jpeg|jpg|gif|png|ico)(\?|$) - [L,NC,R=404] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteRule . /index.php [L] </IfModule> # Redirect www to non-www RewriteCond %{HTTP_HOST} ^www\.pctroubleshooting\.ro$ [NC] RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteRule ^(.*)$ http://pctroubleshooting.ro/$1 [R=301,L] <FilesMatch "\.(css|js)$"> Header set Cache-Control "max-age=604800" </FilesMatch>
Forum IT: PC Troubleshooting - din pasiune pentru calculatoare.
Pornind de la ce ai acolo, incearca asta:
Am ingrosat ce am adaugat la ceea ce deja ai.Cod:# Redirect www to non-www https RewriteCond %{HTTP_HOST} ^www\.pctroubleshooting\.ro$ [NC] RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteRule ^(.*)$ https://pctroubleshooting.ro/$1 [R=301,L] RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Cu precautie ca nu e testat.
Sau poti incerca metoda mai eleganta:
Repet, fii precaut, sunt obosit la ora la care scriu...Cod:RewriteEngine On RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} ^www\. [NC] RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC] RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
Momentan este/sunt 1 utilizator(i) care navighează în acest subiect. (0 membrii și 1 vizitatori)