.htaccess Apache

# -------------------------------------------------------------------
# - Configuración básica de .htaccess para URL amigable
# -------------------------------------------------------------------
 
RewriteEngine On
 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
 
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
 
 
 
# -------------------------------------------------------------------
# - Seguridad ...
# -------------------------------------------------------------------
 
deny
Options None
Options +FollowSymLinks
 
 
# -------------------------------------------------------------------
# - Configuración avanzada - más completa de .htaccess para URL amigable, seguridad, etc.
# -------------------------------------------------------------------
# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)(|~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$">
  Order allow,deny
</FilesMatch>
 
# Don't show directory listings for URLs which map to a directory.
Options -Indexes
 
# Follow symbolic links in this directory.
Options +FollowSymLinks
 
# Make WiMarBueno handle any 404 errors.
ErrorDocument 404 /index.php
 
# Set the default handler.
DirectoryIndex index.php index.html index.htm
 
# Override PHP settings that cannot be changed at runtime. See
 
# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_flag magic_quotes_gpc                 off
  php_flag magic_quotes_sybase              off
  php_flag register_globals                 off
  php_flag session.auto_start               off
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_flag mbstring.encoding_translation    off
</IfModule>
 
RewriteEngine On
 
# Various rewrite rules.
<IfModule mod_rewrite.c>
 
# Use PHP4 as default
#AddHandler application/x-httpd-php4 .php .php4 .php3 .phtml
#AddHandler application/x-httpd-php5 .php #para php 5, actualmente en uso en este server
 
  # If your site can be accessed both with and without the 'www.' prefix, you
  # can use one of the following settings to redirect users to your preferred
  # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  #
  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/... will be redirected to http://www.example.com/...)
  # uncomment the following:
  # RewriteCond %{HTTP_HOST} .
  # RewriteCond %{HTTP_HOST} !^www\. [NC]
  # RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  #
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
  # (http://www.example.com/... will be redirected to http://example.com/...)
  # uncomment the following:
   RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
   RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
 
#RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
 
##Paginas staticas con link amigable :)
RewriteRule ^nosotros/?$ nosotros.php? [QSA,L]
RewriteRule ^clientes/?$ clientes.php? [QSA,L]
RewriteRule ^servicios/?$ servicios.php? [QSA,L]
RewriteRule ^galeria/?$ galeria.php? [QSA,L]
RewriteRule ^contacto/?$ contacto.php? [QSA,L]
 
</IfModule>
 
#Error 404 pagina no enconrada
ErrorDocument 404 /error-404.php
 
 
# -------------------------------------------------------------------
# - Redirect individual archivo
# -------------------------------------------------------------------
 
# Modo 01, lo más simple, el "/old.php" significa que esta en la raiz de la web
RewriteEngine on
rewriterule /old.php http://WilzonMB/new.php [L,R=301,NC]
 
# Modo 02, lo mas simple y con variables.
RewriteEngine on
rewriterule ^old.php(.*)$ http://WilzonMB/new.php$1 [L,R=301,NC]
 
# Modo 03, algo más completo, y con argumentos. significa que obtiene todos los parametros de la url old.php y lo pasa con los mismos parametros al new.php
Options +FollowSymlinks
RewriteEngine on
rewriterule ^old.php(.*)$ http://WilzonMB/new.php$1 [L,R=301,NC]