LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-06-2010, 06:00 PM   #1
hugohome
LQ Newbie
 
Registered: Jul 2010
Location: Buenos Aires, Argentina
Distribution: Debian/Mepis/Fedora/CentOS
Posts: 4

Rep: Reputation: 0
Redirection with different folders


Hi everybody!

I have a problem about redirection over Apache2 over Debian Lenny. We have build a LAMP, and our programmer make a software with these features:

When you put on your browser (i.e.) http://hugohome.org/inside, you access to the program in /var/www/vhosts/hugohome/inside. And when you put http://hugohome.org/outside you access to the program in /var/www/vhosts/hugohome/outside. Today, if you just put http://hugohome.org our Apache answers 403 (forbidden), because we had blocked folder access. (You know....isn't the right way). Our Apache's Document Root is in /var/www/vhosts/hugohome.

Our goal is to change definitely http://hugohome.org to access -> /var/www/vhosts/hugohome/inside. This is our main intention. Also, we can continue with http://hugohome.org/outside pointing to /var/www/vhosts/hugohome/outside. I thought, hmm easy!: I can change the DocumentRoot to /var/www/vhosts/hugohome/inside and try with an Alias to outside. But the problem is that the programmer has taken the software reference with /var/www/vhosts/hugohome and when I tried to change the Document Root the programas didn't work fine (loops, error 404, etc).

¿How can I do?. I have tried with Apache with many manners, but I just have a relative success with:
"RedirectMatch ^/$ http://hugohome.org/inside/". It works, but the Browser shows the ugly http://hugohome.org/inside. Our intention is just show http://hugohome.org. Unfortunately we can't work directly with the DNS servers, and I guess that I can resolve with (i.e.) Apache and Bind together.

¿Any ideas?. Any help will be truly appreciated!!

Have a beautiful weekend!

Hugohome
 
Old 11-07-2010, 03:36 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

You can use mod_rewrite. Create a .htaccess file in your DocumentRoot (/var/www/vhosts/hugohome) containing:
Code:
RewriteEngine on

RewriteCond %{REQUEST_URI} ^/$
RewriteRule (.*) /inside/ [L]
Regards
 
Old 11-09-2010, 09:20 AM   #3
hugohome
LQ Newbie
 
Registered: Jul 2010
Location: Buenos Aires, Argentina
Distribution: Debian/Mepis/Fedora/CentOS
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks Bathory, and my apologize because of my delaying answer. I tried with your tip, but the browser countinues putting "http://www.hugohome.org/inside". Unfortunately the programmer guy and I didn't have more time to testing, because our customer want to kill us. So, we modify the software structure and move the /inside content into the Document Root. At the end, It works with this manner:

At Root --> http://www.hugohome.org (with the former folder "inside" moved at root).

Queries http://www.hugohome.org/outside pointing to the folder "outside". Quite silly solution, but we didn't have more time.

We will try with our local server, to get a final solution. Sooner or later will be cross to the same trouble. When I have a answer, I will put here.

Thanks again and best regards,

Hugohome
 
Old 11-09-2010, 04:07 PM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

It should work.
Maybe apache does not look for .htaccess files. To enable this you need to have:
Code:
AllowOverride All
in the <Directory /var/www/vhosts/hugohome>...</Directory> section of /httpd.conf.

Regards
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mount storage partition folders to home folders skykooler Linux - Newbie 4 10-07-2010 10:56 PM
bash script to create folders including making recursive folders.... linux-bandit Linux - Software 8 11-28-2009 01:50 AM
find -exec command to recursively delete files and folders in folders with X name Joan Murt Linux - Newbie 2 07-08-2009 04:35 PM
change permissions of all folders and sub folders cad Linux - General 3 01-28-2007 10:21 AM
Samba can create new files and folders but access denied in any new folders k.king Linux - Networking 2 01-15-2006 06:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration