Jump to content

Redirectionare Index.php / Index.html Catre "site"


gaby

Recommended Posts

Dupa cum probabil stiti, exista 3 modalitati/adrese de accesare, ale unui singur site.

Si anume:

http://pctroubleshooting.ro

http://www.pctroubleshooting.ro

http://pctroubleshooting.ro/index.php sau http://www.pctroubleshooting.ro/index.php

!!! Observatie: index.php poate fi deasemenea index.html

Pentru a nu avea probleme cu Google -> duplicate content, este bine sa stabiliti adresa principala a site-ului (cu sau fara www: http://pctroubleshooting.ro/index.php?showtopic=2289), apoi sa faceti redirectionari permanente (301) de la celelalte adrese ramase catre cea principala.

De exemplu:

Adresa mea principala este http://pctroubleshooting.ro

Atunci cand voi accesa http://www.pctroubleshooting.ro voi fi redirectionat catre http://pctroubleshooting.ro

Acest lucru se face adaugand codul de mai jos in fisierul .htaccess:

Options +FollowSymLinks 
RewriteEngine on
RewriteCond %{HTTP_HOST} ^site-ul_meu.ro [NC]
RewriteRule ^(.*)$ http://www.site-ul_meu.ro/$1 [L,R=301][/code] Dupa aceea, pentru a redirectiona http://pctroubleshooting.ro/index.php catre http://pctroubleshooting.ro voi utiliza codul de mai jos [i][color=red](bineinteles, tot in .htaccess)[/color][/i]:
[code]RewriteEngine On
RewriteCond %{HTTP_HOST} ^domeniu.ro [NC]
RewriteRule ^(.*)$ http://www.domeniu.ro/$1 [L,R=301]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.domeniu.ro/ [R=301,L]

!!! Puteti inlocui extensia .php cu .html, dupa caz !

Te-ai inregistrat? Ne-ar placea sa te prezinti.

Cum pot sustine forumul?
Cumpara de la eMag folosind acest link.
--------------------
oG2BN9d.gifse1WdXd.gifQG6MtmI.gifRHYjDzD.gifG5p1wui.gif

Link to comment
Share on other sites

  • 1 month later...

Pentru forum-uri, sau pentru site-urile cu continut dinamic, care au link-ul de forma:

nume-site/index.php?action=* vor fi de acum redirectate catre nume-site/?action=*, lucru care nu va face decat sa complice lucrurile.

Ce trebuie sa facem atunci ?

Codul de mai jos, va rezolva problema:

# Redirect 301 /index.php to /
Options +FollowSymLinks
DirectoryIndex index.php
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.nume-site.ro/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L][/code]

Folosind codul de mai sus toate intrarile din browser care contin si index.php, vor fi redirectate catre www.nume-site.ro, insa adresarile interne de genul

[b]nume-site/index.php?action=*[/b] vor conţine mai departe si "index.php"

Te-ai inregistrat? Ne-ar placea sa te prezinti.

Cum pot sustine forumul?
Cumpara de la eMag folosind acest link.
--------------------
oG2BN9d.gifse1WdXd.gifQG6MtmI.gifRHYjDzD.gifG5p1wui.gif

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.