Buenas, he estado haciendo un pequeño proyecto YII en mi servidor local (WAMP)en el cual he activado las url amigables, para ello en mi servidor local he tenido que modificar el .htaccess y el main del proyecto YII.
.htaccess -->
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
Ahora la cuestión es que he migrado mi proyecto a un hosting de pago Linux donde el index me carga bien pero los otros enlaces con URL amigables no me los encuentra.En linux no trabaja con el .htacces o porque puede suceder esto?
el error cuando intenta cargar una url es
The server can not find the requested page:
80.xx.xx.156/~gg/gg/site/about (port 80)
Puede ser que el hosting no permita el uso de .htaccess.
Para probar, podés "romper" el contenido del archivo, por ejemplo agregando una línea sin sentido:
Rompiendo el .htaccess con esta línea
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
Con esto, al visitar el sitio, deberías obtener un SERVER ERROR.
Si no pasa nada, es un problema. Deberías pedirle al administrador que te permita usar este tipo de archivos.
Si en cambio se rompe todo, volvé el archivo a como estaba y fijáte esto.
Viendo estas líneas:
The server can not find the requested page:
80.xx.xx.156/~gg/gg/site/about (port 80)
puede ser que el necesites setear RewriteBase en el .htaccess.
Quedaría por ejemplo:
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
RewriteBase /~gg/gg/
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
Puede ser
RewriteBase /~gg/gg/
o
RewriteBase /~gg/
No estoy muy seguro en este momento, pero probá y avisá.
Hola amigo, pues ya he averiguado porque no funcionaba. Al parecer por motivos de seguridad, muchos hostings tienen desactivado "FollowSymLinks", así que lo he cambiado por "SymLinksIfOwnerMatch" y ya. Un saludo