.htaccess files

MikeVrind

Verified User
Joined
Oct 12, 2008
Messages
47
Location
Netherlands
Hello,

Recently I have installed DA on my server but now I have a small problem.
When I create a new user(domain) via Direct Admin,the .htaccess rewrite rules are ignored by the apache server.

Where and what must I change so that a .htaccess with rewrite rules file is always used for all (future) domains on my server?

The .htaccess file itself is not ignored, but mod_rewrite doesn't do its job (mod_rewrite module is active on the apache server)
The company thats manages our servers says that we should rewrite our urls true direct admin and not .htaccess, this can't be right? right? :p

Could it be a problem that DA was NOT installed on a clean server? Because the complete working webserver was running when DA got installed.

Example of a rewrite rule:
RewriteEngine on
RewriteRule ^news/main/(.*)/(.*)/(.*)/$ index.php?id=$1&aId=$3&pagina=news [L]

Al of the rewrite rules are working perfect on our other server without DA.

Thanks in advance for the help.
 
Last edited:
i'm not an expert on this, but have you got allowoverride set?
 
And where should I put this exactly?
I have tried it on some places in the httpd.conf file, but nothing seem to work after restarting the HTTPD service.
 
as i say i'm not an expert on this but i think if you look in httpd.conf look for <Directory /home/*> and underneath it put AllowOverride All. like this:


<Directory /home/*>
AllowOverride All
 
We have already tried that, and after rebooting the httpd service, it didn't solve the problem with the rewrite rules.
 
have you got this in your htaccess file?

Options +FollowSymlinks
 
I have discovered a verry strange thing.
When a website can be reached via a domain, like www.myDomain.com, the rewrite rules work just fine.
But when we creacte a new user that can only me reached via our.server.ip/~userName/ then te rewrite rules do not work.

When I change the hosts file (windows pc, C:\WINDOWS\system32\drivers\etc) and put the following line in this file:
server.ip.adress www.domain.com

Then the user can be reached via www.domain.com and then the rewrite rules work.

Do you have any clue how I can solve this?
The rewrite rules must work when I create a news user and want to test the website before it goes online.
 
I have discovered a verry strange thing.
When a website can be reached via a domain, like www.myDomain.com, the rewrite rules work just fine.
But when we creacte a new user that can only me reached via our.server.ip/~userName/ then te rewrite rules do not work.

When I change the hosts file (windows pc, C:\WINDOWS\system32\drivers\etc) and put the following line in this file:
server.ip.adress www.domain.com

Then the user can be reached via www.domain.com and then the rewrite rules work.

Do you have any clue how I can solve this?
The rewrite rules must work when I create a news user and want to test the website before it goes online.

sorry i don't but glad wyou got it working
 
It still doesn't work the way I want it to work :p

When I want to test a website of a new user via server.ip/~username/ the rewrite rules also need to work or else I can not test the website before it goes online.
 
I think that is the nature of mod_rewrite. I think its how it was written. But it seems you have already found the solution, using the hosts file.
 
Floyd, is there a way to solve this?

Changing the hosts file on my computer is not a option. I can't do this with every client. And besides that, I am not the only one that would like to test a website before it goes online.
 
Have you tried changing the rule to match ~username/news

I think you need to change the matching rule or add the matching rule so that when the domain does resolve both types of access will work.

mod_rewrite drives me nuts.
 
^news is never going to match anything you need to change it to

RewriteRule /news/main/(.*)/(.*)/(.*)/$ index.php?id=$1&aId=$3&pagina=news [L]
 
MikeVrind,

As users floyd scsi have pointed out, the rewrite rules have to match what you're typing into your browser. So you either have to use rewrite rules that match ~username/news or you have to use the hosts file.

We find that using the hosts file is easier. You can always create a link to it on your desktop; that's what we do here, so we change it often if required.

Jeff
 
Back
Top