Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Yet another mod_rewrite question (sigh!) [kind of solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
frix
n00b
n00b


Joined: 02 Feb 2006
Posts: 8
Location: Sweden

PostPosted: Mon Mar 27, 2006 12:01 pm    Post subject: Yet another mod_rewrite question (sigh!) [kind of solved] Reply with quote

I've been googling and wading through numerous posts/forums/whatever without getting closer to a solution so I'm asking for your collective wisdom... 8)

What I'm trying to do is to move the web root from the standard 'htdocs' to a directory on the same level, called 'web2'.
'htdocs' contains just a few static html files, while 'web2' contains a brand new site based on Joomla. I've tried several different
setups using mod_rewrite rules but, needless to say, I've not been able to get it work. So if there's a kind soul out there who can point me in the right direction I would be more than grateful.

directory structure:

/var/www/localhost
| htdocs
| web2
| cgi-bin
| error
| icons

To be able to test 'web2' during the development, I put a symlink in 'htdocs' called 'web2' which points to ../web2
I know that the 'mod_rewrite' is working, since I've turned on logging for it, it's just that I don't seem to be able to figure out the correct rule for it.

Thnx in advance!


Last edited by frix on Mon Mar 27, 2006 5:15 pm; edited 1 time in total
Back to top
View user's profile Send private message
minskpower
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jun 2005
Posts: 94
Location: /dev/null

PostPosted: Mon Mar 27, 2006 4:01 pm    Post subject: Reply with quote

But why mod_rewrite?
Why not change the DocumentRoot if you want to move the default root?
mod_rewrite would make sense if you had web2 inside htdocs but this setup of yours is confusing :)
Back to top
View user's profile Send private message
frix
n00b
n00b


Joined: 02 Feb 2006
Posts: 8
Location: Sweden

PostPosted: Mon Mar 27, 2006 5:12 pm    Post subject: Reply with quote

Mmm... I kind of solved it, but in a less satisfying way. You see, 'web2' contains a Joomla-webpublishing system and it has loads of references to 'web2'.
Changing just the document root worked for the frontpage (even though it didn't looked quite right...) but none of the links worked, as they referenced 'web2'. But adding a symlink called 'web2' inside that directory, pointing to the very same directory, seems to have solved it for now. Even though 'web2' is displayed every now and then in the address field of the browser. It would be nice to get rid of that, but I guess I can live with it...
Back to top
View user's profile Send private message
minskpower
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jun 2005
Posts: 94
Location: /dev/null

PostPosted: Mon Mar 27, 2006 6:09 pm    Post subject: Reply with quote

Aaah, hardcoded link paths, how nice :)
You could do a mass replace I guess, but otherwise I think this is going to haunt you..
Back to top
View user's profile Send private message
frix
n00b
n00b


Joined: 02 Feb 2006
Posts: 8
Location: Sweden

PostPosted: Mon Mar 27, 2006 7:39 pm    Post subject: Reply with quote

Mass replace? Umm... don't think so... 8)
Joomla! is database driven and consists of 80 different tables.
Most of the information is stored in the database, and it's probably not very
wise to poke around in there... 8)
Back to top
View user's profile Send private message
markandrew
Apprentice
Apprentice


Joined: 04 Feb 2004
Posts: 176
Location: Manchester, UK

PostPosted: Tue Mar 28, 2006 3:00 pm    Post subject: Reply with quote

it sounds like your new (joomla) site has been misconfigured - to expect document root at /var/www, which i'm guessing isn't what you want

try:

Alias /web2/ /var/www/web2
DocumentRoot /var/www/web2

or:

DocumentRoot /var/www/web2
RewriteRule ^/web2/(.*) /$1 [QSA]

but to be honest, I'd be looking at reconfiguring the joomla site to use /var/www/web2 as the webroot, anything else is a bit of a hack - you might get recursive nastiness trying to work round it with the above
Back to top
View user's profile Send private message
frix
n00b
n00b


Joined: 02 Feb 2006
Posts: 8
Location: Sweden

PostPosted: Wed Mar 29, 2006 6:45 pm    Post subject: Reply with quote

Actually, it seems to work ok now. I know it's probably not right way to do it, but this was the least complicated way...
All I did was to set the DocumentRoot to /var/www/localhost/web2 (instead of /var/www/localhost/htdocs) and in the
new web root, added a symlink with 'ln -s . web2'. It doesn't feel broken, even the webshop module works ok, and the
only drawback is that the URL displays 'web2'. But I'll take a look at your suggestions, thanks anyway!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum