0

What actually are the steps to clean the URL of a site.

I have made the following changes in the /etc/apache2/sites-enabled/000-default file.

<VirtualHost *:80>

    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all
        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
</VirtualHost>

What are the changes I need to do in a .htaccess file so that I could enable clean URLs?

closed as off topic by niksmac, AjitS, monymirza, mpdonadio Jun 8 '13 at 16:52

Questions on Drupal Answers are expected to relate to Drupal within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Seems better suited for serevr fault. You need your Drupal to "see" index.php?q=/some/path if there is no physical file under given real path. The rest is purely server dependent and does not depend on the CMS you're using. – Mołot Jun 4 '13 at 6:49
  • Mołot i want my site to like /some/path instead of ?q=some/path.I had made changes in 000-default file but don't know what exactly need to be done in .htaccess file. – Nitesh Sethia Jun 4 '13 at 7:09
  • Drupal needs to "receive" $_GET['q'] variable, but creating it from user friendly address input is purely server thing. – Mołot Jun 4 '13 at 7:13
  • On the assumption that this is talking specifically Drupal, then I don't necessarily think it should be closed. However - the documentation is pretty clear on the setup. Perhaps a little RTFM is in order? ;-) – Chapabu Jun 4 '13 at 8:29
  • The question should be edited to make it a Drupal question. I would suggest to read the documentation pointed by @Chapabu and then ask a question if you don't understand something in the documentation. – kiamlaluno Jun 7 '13 at 5:19
4

You do not need to do any edits in the Drupal default .htaccess file to have Drupal 7 enable clean URLs. Instead, navigate to Home » Administration » Configuration » Search and metadata (its the link named "Clean URLs" on the Admin's Configuration page, and press the button "Run the clean URL test".

If the test is successful, Drupal will make use of its default .htaccess to do the rewrites. If the test fails, then you need to review your configuration.

Some suggestions:

Make sure that the Drupal default .htaccess is present in your webroot (/var/www).

Make sure that you've actually enabled mod_rewrite for Apache, e.g.:

 sudo a2enmod rewrite

You must also restart Apache after changing defaults, e.g.:

 sudo service apache2 restart

(The example shell commands above are for Ubuntu. If you run a different dialect of GNU/Linux, you may need to use slightly different shell commands.)

  • The test is failing so how should i review the Apache configuration ie what should i do to make the test successful. – Nitesh Sethia Jun 4 '13 at 7:31
0

Seems like you don't have the default .htaccess file present in you Drupal root directory. You can try this

  1. Download the fresh copy of Drupal.
  2. Copy the .htaccess file, from the newly downloaded Drupal tarball to your sites root directory.
  3. Run the test again.

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