LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-16-2008, 09:48 AM   #1
plk
Member
 
Registered: May 2007
Location: Krakow, Poland
Distribution: Dell Inspiron 6400 - Intel Core 2 Duo - Ubuntu 8.04
Posts: 57

Rep: Reputation: 15
Apache2 redirect


Hi there.

From what I understand from this page , aliasing is pretty straight forward.

However, what I want to do is:

When I'm developing on my localhost, I would like all my links pointing to sub pages to be something like href=www.mysite.com/mypage.php instead of just href=mypage.php or href=localhost.php

So what I though was add an alias like:

Code:
Alias www.mysite.com localhost
In the same sens that this shouuld work if I add to the apache2.conf file:

Code:
Alias site1 site2
After i restart apache, my browser still opens site1 instead of site2 .. is there something I don't get?

thanks in advance.

plk
 
Old 11-16-2008, 10:20 AM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Are you using 1.3 or 2.0 (or 2.2)? Your documentation URL points to 1.3, but your reference to apache2.conf suggest 2.0.

# httpd -v <-- will tell you

I'm not sure I understand what you are trying to do, but perhaps you are intending to look for the Redirect directive.
 
Old 11-16-2008, 02:47 PM   #3
plk
Member
 
Registered: May 2007
Location: Krakow, Poland
Distribution: Dell Inspiron 6400 - Intel Core 2 Duo - Ubuntu 8.04
Posts: 57

Original Poster
Rep: Reputation: 15
Sorry Im on Apache 2.

Ok, so what im trying to do is:

Say I have a piece of code on my website like:

PHP Code:
<a href="http://www.mysite.com/images/picture.jpg">Click here</a
And im developing it on my local computer. What I want is to edit my files and check if everything works without having to develop on the server. Also, without having to edit the above line of code so it reads

PHP Code:
<a href="http://localhost/images/picture.jpg">Click here</a
I think Its clearer than before :-)
 
Old 11-16-2008, 03:15 PM   #4
plk
Member
 
Registered: May 2007
Location: Krakow, Poland
Distribution: Dell Inspiron 6400 - Intel Core 2 Duo - Ubuntu 8.04
Posts: 57

Original Poster
Rep: Reputation: 15
ignore this post, mistake.

Still waiting for some help tho :-)

Last edited by plk; 11-16-2008 at 04:41 PM. Reason: server sent twice
 
Old 11-16-2008, 07:27 PM   #5
Shinigami101
LQ Newbie
 
Registered: Nov 2008
Posts: 7

Rep: Reputation: 0
Quote:
Originally Posted by plk View Post
Sorry Im on Apache 2.

Ok, so what im trying to do is:

Say I have a piece of code on my website like:

PHP Code:
<a href="http://www.mysite.com/images/picture.jpg">Click here</a
And im developing it on my local computer. What I want is to edit my files and check if everything works without having to develop on the server. Also, without having to edit the above line of code so it reads

PHP Code:
<a href="http://localhost/images/picture.jpg">Click here</a
I think Its clearer than before :-)
You should never has to use;

PHP Code:
<a href="http://localhost/images/picture.jpg">Click here</a
when making a website you should just be able to

PHP Code:
<a href="images/picture.jpg">Click here</a
 
Old 11-17-2008, 12:16 AM   #6
plk
Member
 
Registered: May 2007
Location: Krakow, Poland
Distribution: Dell Inspiron 6400 - Intel Core 2 Duo - Ubuntu 8.04
Posts: 57

Original Poster
Rep: Reputation: 15
Yeah I actually need to use that. I'm concerned about search engines ranking so you know ...
 
Old 11-17-2008, 08:13 PM   #7
sleddog
Member
 
Registered: Jan 2002
Location: Labrador, Canada
Distribution: CentOS, Debian
Posts: 182

Rep: Reputation: 35
You can use:

Code:
<a href="http://www.mysite.com/images/picture.jpg">Click here</a>
And make an entry in the hosts file on your local computer. The file is /etc/hosts on Linux and something like C:\windows\system32\drivers\etc\hosts on a Windows box.

Add a line like:

Code:
192.168.1.1 www.mysite.com
Substituting your local IP and the domain you're actually using. Restart your web browser so it sees the change.

Remove the line when you're ready to go live on the server.
 
Old 11-27-2008, 01:37 PM   #8
plk
Member
 
Registered: May 2007
Location: Krakow, Poland
Distribution: Dell Inspiron 6400 - Intel Core 2 Duo - Ubuntu 8.04
Posts: 57

Original Poster
Rep: Reputation: 15
Thanks a lot man.

However, I decided to do something else.

I'll just include a $path variable to all my php files on the server so I can actually develop multiple servers at the same time.

If using the etc/hosts method (which works just fine) it redirects to my localhost IP, no sub folders etc..

Anyhow. Thank you!!

plk
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
apache2 suse10.3 redirect to home directory as / is full master Linux - Server 2 05-28-2008 02:31 AM
Apache2 .htaccess redirect problem raven Linux - Networking 0 08-06-2007 02:35 AM
Apache2 Network Share Redirect nuebKitsune Linux - Newbie 2 01-28-2007 05:59 PM
redirect SquirrelMail from http to https using Apache2 cccc Linux - Server 3 09-23-2006 10:02 AM
Apache2 internal redirect? WopMaster8 Linux - Software 2 03-28-2005 01:25 AM

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

All times are GMT -5. The time now is 05:51 AM.

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