Clean URL's not working, mod_rewrite module in

2019-05-13 22:54发布

I just installed a fresh copy of Drupal 6.19 to get to speed on how to write modules. But for some reason the rewrite module isn't working for Drupal.

What I have checked:

  • $ apachectl -M >> it is installed
  • php_info() on current server >> says rewrite is installed also
  • I also double-checked the .htaccess file in my Drupal root folder
  • UPDATE: checked httpd.conf for AllowOverride All

I'm out options here. Looked everywhere but the Drupal settings aren't letting me to enable the settings and their test is simply visiting a site that should work if the rewrite module was there.

My specs: Mac OS X 10.6 Snow Leopard Using built-in Apache with PHP5

Thanks!

8条回答
一夜七次
2楼-- · 2019-05-13 23:48

A clean url could be something like www.example.com/fisherman instead of www.example.com/data/pages/fisherman.php

Some installations of apache have clean URL functionality out of the box. There are 2 steps that need to be configured correctly for it to work.

Enable rewrite module
Allow .htaccess file overrides

Both steps require SSH root access to your server. So if you are on shared host this probably won't work for you. Open your terminal:

  1. Enable rewrite module

To enable the rewrite module, you can type the following command

sudo a2enmod rewrite

Now type

sudo service apache2 restart

to enable the changes. You can check if it’s working by typing

sudo apache2ctl –M

A list will appear. Look for “rewrite_module”.

http://codeontrack.com/enable-clean-urls-apache/

查看更多
三岁会撩人
3楼-- · 2019-05-13 23:50

Make sure that if the install is in a sub-directory that the username is part of the rewriteBase

# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
RewriteBase /~username/drupal**
查看更多
登录 后发表回答