The clean URL test failed in drupal 7

微笑、不失礼 提交于 2019-12-11 04:04:00

问题


The clean URL test failed. It was working correctly on my local computer, when I uploaded it to server I got this message and I could not enable the clean url. What should I do to enable it? I have uploaded the htaccess also.


回答1:


There are a number of requirements you'll need to confirm are met on the server. After confirming Apache is allowing your local .htaccess configuration override (as per Ayesh's comment) I'd start by checking info.php to see if mod_rewrite is loaded.

Make sure you remove info.php when you're done checking as you should not have this on a production server.




回答2:


have a look at Configure clean URLs, suppose you are using apache2

  1. enabled mod-rewrite in apache

    sudo a2enmod rewrite

  2. vi /etc/apache2/sites-enabled/000-default, change AllowOverride from None to All

<Directory /var/www/>
   Options Indexes FollowSymLinks MultiViews
   AllowOverride All
   Order allow,deny
   allow from all
</Directory>
  1. vi httpd.conf, add this
<Directory /var/www/>
      RewriteEngine on
      RewriteBase /
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>

2. restart apache

sudo service apache2 restart



回答3:


If your entire site is password protected (via cpanel/.htaccess) Then the test will not pass. This may not be the solution but is worth checking.

I disabled password protection by commenting out the following lines in my .htaccess file.

AuthType Basic
AuthName "public_html"
AuthUserFile "/home/********/.htpasswds/public_html/passwd"
require valid-user

Run the test again, if it passes, tick the box then be sure to uncomment the previously commented lines.



来源:https://stackoverflow.com/questions/12759103/the-clean-url-test-failed-in-drupal-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!