Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 15-04-2009
Member
 
Join Date: Feb 2009
Posts: 66
mod_rewrite and .htaccess does not work

Hello programming gurus

I'm having trouble getting mod_rewrite to work with Apache 2.0 on Ubuntu 9.04. I ran the command "sudo a2enmod rewrite" and it said that the module was installed.
And with the trouble using both trouble mod_rewrite and .htaccess is that When i put the rewrite rules in httpd.conf, they work fine. But when I put them in .htaccess, they don't work.

Thank for your support
Reply With Quote
  #2  
Old 15-04-2009
Member
 
Join Date: Apr 2008
Posts: 193
Re: mod_rewrite and .htaccess does not work

The code should be added to the .htaccess file in the root directory, but then again I don't think it will actually make a difference; as long as it doesn't conflict with any other rewrite rules in your root directory's .htaccess file. The rule you've referred is needed for clean urls, it can be left alone, in fact none of rules present in drupals main .htaccess file shouldn't cause any problems.

In my case I actually move drupal the site to the root directory, the rewrite rule causes any calls to the subdirectory to be rooted to the root directory, but I believe this should still work in your case.
Reply With Quote
  #3  
Old 15-04-2009
Member
 
Join Date: Dec 2008
Posts: 161
Re: mod_rewrite and .htaccess does not work

You could add

Options -indexes

and

Directoryindex default.php

near the top of the appropriate .htaccess file(s), in order to tell the server to return "default.php" whenever "/" is requested. See Apache mod_dir and Options in Apache Core documentation for details.
Reply With Quote
  #4  
Old 15-04-2009
Member
 
Join Date: Dec 2008
Posts: 183
Re: mod_rewrite and .htaccess does not work

Here's a summary of what he said was needed to fix that in the event of nonexistent subdomains needing to be redirected:

1. add a subdomain through cpanel, name it * and point it to the public_html directory.

2. You need to create a * DNS record as well.

3. Each subdomain has it's own VirtualHost block under Apache, so existing ones would be directed where they need to go.

4. Non-existing subdomains would be sent to the main domain and be caught by the .htaccess file. You could then change the line "RewriteCond %{HTTP_HOST} example.com [NC]" to read "RewriteCond %{HTTP_HOST} !" instead.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "mod_rewrite and .htaccess does not work"
Thread Thread Starter Forum Replies Last Post
How to use .htaccess file Antarjot Operating Systems 3 09-12-2009 01:40 PM
Problem with .htaccess on Mac OS X austin26 Software Development 3 03-12-2009 06:00 PM
What is htaccess? What does it mean in programming language? Aienstaien Software Development 4 16-09-2009 02:48 PM
.htaccess and error 403 CitricAcid Software Development 4 27-04-2009 12:24 PM
.Htaccess problem Jasonholt Software Development 3 06-04-2009 09:08 PM


All times are GMT +5.5. The time now is 06:41 AM.