-1

Clean URL test fails but unable to enable it. Here is my configuration files. I am able to access the page via example.com/admin/config/search/clean-urls as well as example.com/?q=admin/config/search/clean-urls

enter image description here

enter image description here

  • 2
    You are unable to enable it because the test fails ;-) I think, the rewrite module isn't enabled for your APACHE server. You can try executing sudo a2enmod rewrite – AjitS May 12 '14 at 8:47
  • Wait, how is it that test fails if you can, in fact, access page using clean URLs? Never heard it to be possible – Mołot May 12 '14 at 8:54
  • @AjitS its enabled see i.stack.imgur.com/mMbz0.png – niksmac May 12 '14 at 9:28
  • @Mołot see this i.stack.imgur.com/JxC4Q.png i cant enable it. Form never get saved. – niksmac May 12 '14 at 9:28
  • @Mołot, oh its fine. Any suggestion or thoughts ? – niksmac May 12 '14 at 10:28
0

The mistake is in your [QSA] flag:

To combine a new query string with an old one, use the [QSA] flag.

You don't want to do that. Drupal works fine with just:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]

If you will combine original query string with new one, then the test in system_clean_url_settings() have to fail, as it is:

if (strpos(request_uri(), '?q=') !== FALSE) {

If you are attaching original query string to new one, you are also adding that ?q=, and this makes Drupal think you are still using non-clean method.

  • Note: I know I oversimplified how mod_rewrite and QSA works. It is the detail level that lets me get my stuff done, but if you are pro Apache admin and you are giggling now, feel free to post more detailed explanation, or edit my post with details. – Mołot May 12 '14 at 10:48
  • I tried your suggestion, its still the same. Enable clean URLs form not getting saved. Clean URL test fails but url works without ?q= – niksmac May 12 '14 at 14:45
  • but in my subdomain its not working without ?q= – niksmac May 12 '14 at 14:46
  • I never had problems with subdomains, without any QSA flag and with clean urls. Always using Drupal's standard .htaccess. As far as I know, um.warszawa.pl and all it's subdomains, like zielona.um.warszawa.pl are still built just that way, and there are no problems. So it's some deeper problem with your subdomains, I'm afraid. – Mołot May 12 '14 at 14:50
  • Can you help me further on this? Do you need any more info? – niksmac May 13 '14 at 4:48
0

Check if you have .htaccess in your drupal root directory, it is hidden by default so to check if you have .htaccess in file simply ls -a in your drupal root directory.

  • .htaccess is there and its working. – niksmac May 21 '14 at 4:31
0

You haven't specified it in your question, but is the subdomain located in the same directory /var/www? As far as I know rewrite rules are per directory. If this is the casa as it looks to me, you have to another rewrite rule.

This works as charm for me:

<VirtualHost *:80>
    ServerAdmin webmaster@mydomain.com
    DocumentRoot /var/www/mydomain.com/
    ServerName www.mydomain.com
    ServerAlias *.mydomain.com mydomain.com
    UseCanonicalName On
    ErrorLog logs/mydomain.com.err
    CustomLog logs/mydomain.com common
</VirtualHost>

<VirtualHost *:443>
    ServerAdmin webmaster@mydomain.com
    DocumentRoot /var/www/mydomain.com/
    ServerName www.mydomain.com
    ServerAlias *.mydomain.com mydomain.com
    UseCanonicalName On
    ErrorLog logs/mydomain.com.err
    CustomLog logs/mydomain.com common
</VirtualHost>


<Directory /var/www/mydomain.com/>
   RewriteEngine on
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>

If you have the subdomain located in another path then you mast add a second rewrite rule.

<VirtualHost *:80>
    ServerAdmin webmaster@mydomain.com
    DocumentRoot /var/www/second_domain.mydomain.com/
    ServerName second_domain.mydomain.com
    ServerAlias *.second_domain.mydomain.com
    UseCanonicalName On
    ErrorLog logs/second_domain.mydomain.com.err
    CustomLog logs/second_domain.mydomain.com common
</VirtualHost>

<VirtualHost *:443>
    ServerAdmin webmaster@mydomain.com
    DocumentRoot /var/www/second_domain.mydomain.com/
    ServerName second_domain.mydomain.com
    ServerAlias *.second_domain.mydomain.com
    UseCanonicalName On
    ErrorLog logs/second_domain.mydomain.com.err
    CustomLog logs/second_domain.mydomain.com common
</VirtualHost>


<Directory /var/www/second_domain.mydomain.com/>
   RewriteEngine on
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory> 

Also, remember to restart the httpd server: service httpd restart

Change the paths and the domain names accordingly. Are you using the root /var/www? For your site, it would be better if you used a subdirectory to store your sites as in this example. Furthermore, if you continue using the path /var/www check that there is not another rewrite rule included by default in your configuration file. In vi: when not editing, press slash and add te text: www, and press enter, // enter to search again; and check there is not any other rewrite rule for this path...

Another problem may be with the caches, check Admin/Configuration/Performance and click on Clear all caches.

I hope that this may be helpful...

  • Its a typical subdomain in /var/www/sites 1 site named dev and 1 is live i mapped the live www site to a subfolder in /sites like /sites/www.site.com. Am i clear ? – niksmac May 21 '14 at 4:31
  • Have you tried any of this? – Carles Estevadeordal May 21 '14 at 22:47
  • As i told you my folders are not different as you specified in the answer. – niksmac May 23 '14 at 1:19
  • I see, loosing my time here... – Carles Estevadeordal May 24 '14 at 16:07
0

The clean URLs test does a local HTTP request

$request = drupal_http_request($GLOBALS['base_url'] . '/admin/config/search/clean-urls/check');

I think in your case, the drupal_http_request is failing so Drupal marks the clean url test as failed.

More info: system_clean_url_settings

  • But i am able to browse the site without the ?q= thats what driving me crazy. – niksmac May 21 '14 at 4:32
  • Yes, it's only the test that fails, clean urls still work, silly I know. You'll need to figure out why the local drupal_http_request is failing in your environment there – David Thomas May 21 '14 at 9:29
  • Any clue on that? I have no idea on that. – niksmac May 21 '14 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.