Clean URLs – URL limpias en drupal
El proceso consiste en 2 pasos:
-
- Configuración de Apache:
-
- Configuración general:
- /etc/apache2/conf.d/drupal-dev.conf
Alias /eSM /var/www/eSM/drupal-dev <Directory /var/www/eSM/drupal-dev> Options +FollowSymLinks AllowOverride All # AllowOverride None order allow,deny allow from all RewriteBase /drupal-dev Include /var/www/eSM/drupal-dev/.htaccess </Directory> - Configuración general:
-
- Virtualhosts:
- /etc/apache2/sites-enabled/000-default
o bien
/etc/apache2/httpd.conf<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> # <Directory /var/www/BTN/drupal-dev> # AllowOverride All # </Directory> </VirtualHost> <VirtualHost *> ServerName eSM DocumentRoot /var/www/eSM/drupal-dev ErrorLog /var/log/apache2/eSM_error.log CustomLog /var/log/apache2/eSM_access.log combined </VirtualHost>-
- Hosts:
- /etc/hosts
127.0.0.1 localhost.localdomain localhost eSM - Hosts:
-
- Activar la reescritura:
a2enmod rewrite sudo /etc/init.d/apache2 reload - Activar la reescritura:
- Virtualhosts:
- Configuración de Apache:
-
- Configuración de .htacces en drupal:
# # Apache/PHP/Drupal settings: # # Protect files and directories from prying eyes. Order deny,allow Deny from all # Set some options. Options -Indexes Options +FollowSymLinks # Customized error messages. ErrorDocument 404 /index.php # Set the default handler. DirectoryIndex index.php # Override PHP settings. More in sites/default/settings.php # but the following cannot be changed at runtime. # PHP 4, Apache 1 php_value magic_quotes_gpc 0 php_value register_globals 0 php_value session.auto_start 0 # PHP 4, Apache 2 php_value magic_quotes_gpc 0 php_value register_globals 0 php_value session.auto_start 0 # PHP 5, Apache 1 and 2 php_value magic_quotes_gpc 0 php_value register_globals 0 php_value session.auto_start 0 # Reduce the time dynamically generated pages are cache-able. ExpiresByType text/html APACHE_LOG_DIR # Various rewrite rules. RewriteEngine on # If your site can be accessed both with and without the prefix www. # you can use one of the following settings to force user to use only one option: # # If you want the site to be accessed WITH the www. only, adapt and uncomment the following: # RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC] # RewriteRule .* http://www.example.com/ [L,R=301] # # If you want the site to be accessed only WITHOUT the www. , adapt and uncomment the following: # RewriteCond %{HTTP_HOST} !^example\.com$ [NC] # RewriteRule .* http://example.com/ [L,R=301] # Modify the RewriteBase if you are using Drupal in a subdirectory and # the rewrite rules are not working properly. RewriteBase / # Rewrite old-style URLs of the form 'node.php?id=x'. #RewriteCond %{REQUEST_FILENAME} !-f #RewriteCond %{REQUEST_FILENAME} !-d #RewriteCond %{QUERY_STRING} ^id=([^&]+)$ #RewriteRule node.php eSM/index.php?q=node/view/%1 [L] # Rewrite old-style URLs of the form 'module.php?mod=x'. #RewriteCond %{REQUEST_FILENAME} !-f #RewriteCond %{REQUEST_FILENAME} !-d #RewriteCond %{QUERY_STRING} ^mod=([^&]+)$ #RewriteRule module.php eSM/index.php?q=%1 [L] # Rewrite rules for static page caching provided by the Boost module # BOOST START AddCharset utf-8 .html RewriteCond %{REQUEST_URI} !^/cache RewriteCond %{REQUEST_URI} !^/user/login RewriteCond %{REQUEST_URI} !^/admin RewriteCond %{HTTP_COOKIE} !DRUPAL_UID RewriteCond %{REQUEST_METHOD} ^GET$ RewriteCond %{QUERY_STRING} ^$ RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0/%{REQUEST_URI} -d RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0/%{REQUEST_URI}/index.html -f RewriteRule ^(.*)$ cache/%{SERVER_NAME}/0/$1/index.html [L] RewriteCond %{REQUEST_URI} !^/cache RewriteCond %{REQUEST_URI} !^/user/login RewriteCond %{REQUEST_URI} !^/admin RewriteCond %{HTTP_COOKIE} !DRUPAL_UID RewriteCond %{REQUEST_METHOD} ^GET$ RewriteCond %{QUERY_STRING} ^$ RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0/%{REQUEST_URI}.html -f RewriteRule ^(.*)$ cache/%{SERVER_NAME}/0/$1.html [L] # BOOST END # Rewrite current-style URLs of the form 'index.php?q=x'. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ eSM/index.php?q=$1 [L,QSA] # $Id: boosted.txt,v 1.4 2006/12/05 10:39:19 arto ExpiresByType - Configuración de .htacces en drupal:
Advertisement
Acerca de esta Entrada
Estás leyendo “Clean URLs – URL limpias en drupal,” una entrada de Insaneisnotfree's Weblog
- Publicado:
- julio 22, 2011 / 12:14 pm
- Categoría:
- Uncategorized
- Etiquetas:
Sin comentarios aún
Ir al formulario de comentarios | Comentarios RSS [?] | trackback uri [?]