Diferencia entre revisiones de «Usuario:Lmorillas/desarrollo web servidor/php/urls amigables»
De WikiEducator
Línea 1: | Línea 1: | ||
{{MiTitulo|Urls amigables}} | {{MiTitulo|Urls amigables}} | ||
− | + | == Clean URL - Friendly URL == | |
+ | Fáciles de recordar, buenas para los usuarios y para los buscadores | ||
+ | |||
+ | |||
+ | == Algunos docs== | ||
* http://www.miguelmanchego.com/2010/php-friendly-url-amigable/ | * http://www.miguelmanchego.com/2010/php-friendly-url-amigable/ | ||
* http://www.baluart.net/articulo/urls-amigables-con-php | * http://www.baluart.net/articulo/urls-amigables-con-php | ||
* http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/ | * http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/ | ||
* http://net.tutsplus.com/tutorials/other/using-htaccess-files-for-pretty-urls/ | * http://net.tutsplus.com/tutorials/other/using-htaccess-files-for-pretty-urls/ | ||
+ | |||
+ | |||
+ | == Activar mod_rewrite == | ||
+ | sudo a2enmod rewrite | ||
+ | sudo service apache2 restart | ||
+ | |||
+ | |||
+ | |||
+ | == Emular carpetas == | ||
+ | RewriteRule /local/(.*)/ index.php?page=local&link=$1 | ||
+ | RewriteRule local/(.*) index.php?page=local&link=$1 | ||
+ | |||
+ | index.php?page=local&link=restaurante-san-jose | ||
+ | www.misitio.com/local/restaurante-san-jose/ | ||
+ | |||
+ | == Crear página html == | ||
+ | RewriteRule (.*)\.html$ index.php?page=$1 | ||
+ | |||
+ | index.php?page=mipagina | ||
+ | mipagina.html |
Revisión de 11:45 28 ene 2014
Contenido
Clean URL - Friendly URL
Fáciles de recordar, buenas para los usuarios y para los buscadores
Algunos docs
- http://www.miguelmanchego.com/2010/php-friendly-url-amigable/
- http://www.baluart.net/articulo/urls-amigables-con-php
- http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/
- http://net.tutsplus.com/tutorials/other/using-htaccess-files-for-pretty-urls/
Activar mod_rewrite
sudo a2enmod rewrite sudo service apache2 restart
Emular carpetas
RewriteRule /local/(.*)/ index.php?page=local&link=$1 RewriteRule local/(.*) index.php?page=local&link=$1
index.php?page=local&link=restaurante-san-jose www.misitio.com/local/restaurante-san-jose/
Crear página html
RewriteRule (.*)\.html$ index.php?page=$1 index.php?page=mipagina mipagina.html