2013-02-06 31 views
6

Chciałbym ukryć stronę index.php i po prostu pokazać domenę..htaccess przekierowanie index.php do/

Czy jest to możliwe z .htaccess?

RewriteRule ^index\.php/?$/[L,R=301,NC] 

próbował również:

RewriteEngine On 
RewriteBase/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /index.php HTTP/ 
RewriteRule ^index.php$ http://example.com/ [R=301,L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 

index.php nadal pokazuje

Odpowiedz

9

spróbować, to działa na mnie! Upewnij się, że masz AllowOverride All zestaw w httpd.conf

RewriteEngine On 

    RewriteCond %{REQUEST_URI} index\.php 
    RewriteRule ^(.*)index\.php$ /$1/ [R=301,L] 

Jest regex problem w regułach, mam zmodyfikowane reguły i to działa na mnie:

RewriteEngine On 
RewriteBase/
RewriteCond %{THE_REQUEST} index\.php 
RewriteRule ^index\.php$ http://example\.com/ [R=301,L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index\.php [L] 
+0

nope. czy przeglądarki zawsze wyświetlają index.php i nie przekierowują tylko do domeny? –

+0

Czy możesz opublikować swój plik .htaccess. – Satish

+0

pisał powyżej wat i mam –

3
RewriteRule ^(.*)index\.(html|php)$ http://%{HTTP_HOST}/$1 [R=301,L] 
Powiązane problemy