Kā atbrīvoties no index.html un index.php lapas adresē

Pirms dažām dienām Konstruktors.com bloga komentāros ieliku savu versiju Karspara variantam par to kā no adreses noņemt index.html paplašinājumu, lai izvairītos no dubulta satura (kas veidojas ar un bez index.html vai index.php).

.htaccess faila kods:

# Noņem  index.html UN index.php no www adreses beigām
RewriteCond %{THE_REQUEST} /index.(php|html) HTTP [NC] # pārbauda vai ir index fails (html vai php)
RewriteRule (.*)index.(php|html)$ /$1 [R=301,L] #aizvieto ar /

Darbojas arī, ja domēns ir kāda cita domēna apakšdirektorija, piemēram, example.com/example2.com, (pārbaudīts uz GoDaddy.com hostinga)

Svarīga iebilde: Dažām web aplikācijām ir nepieciešams index.php, lai veiktu instalācijas procesu

VN:F [1.9.16_1159]
Rating: 0.0/5 (0 votes cast)

Pirms dažām dienām Konstruktors.com bloga komentāros ieliku savu versiju Karspara variantam par to kā no adreses noņemt index.html paplašinājumu, lai izvairītos no dubulta satura (kas veidojas ar un bez index.html vai index.php)….

Nav komentāru.

Leave a Reply

Your email is never published nor shared.

*

You may use these HTML tags and attributes:
<a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>