?
Solved

Mapping URL in PHP

Posted on 2007-11-16
15
Medium Priority
?
1,571 Views
Last Modified: 2013-12-13
Configured wamp on windows 2003 server. Installed two applications 1. mrbs 2. wiki. If I type http://wiki.def.com, it goes to wamp main page. If I type http://mrbs.def.com/mrbs it goes to mrbs home page, if I type http://wiki.def.com/wiki it goes to wiki main page.
I need to map
1.http://mrbs.def.com/mrbs to http://mrbs.def.com 
2. http://wiki.def.com/wiki to http://wiki.def.com 
Please help. I am a beginner to PHP, MySQL, Apache.
0
Comment
Question by:abguttikonda
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
  • 2
15 Comments
 
LVL 48

Expert Comment

by:hernst42
ID: 20300376
You need to configure virtual hosts within the apache. See http://httpd.apache.org/docs/2.0/vhosts/name-based.html
0
 
LVL 3

Expert Comment

by:pmctrek
ID: 20300428
You need to add the code below to the end of the httpd.conf file in apache to tell it were to look when it receives the request from the client, and restart apache.

This code assumes that mrbs and wiki are sudirectories inside the htdocs directoy of apache, if not just replace the DocumentRoot with the complete path c:\www\wiki.

Paul
NameVirtualHost *:80
 
<VirtualHost *:80>
  ServerName mrbs.def.com
  ServerAlias mrbs
  DocumentRoot mrbs
</VirtualHost>
 
<VirtualHost *:80>
  ServerName wiki.def.com
  ServerAlias wiki
  DocumentRoot wiki
</VirtualHost>

Open in new window

0
 

Author Comment

by:abguttikonda
ID: 20301099
I have added the following code to the end of httpf.conf file and restarted all the services.
NameVirtualHost *:80
 <VirtualHost *:80>
  ServerName mrbs.def.com
  ServerAlias mrbs
  DocumentRoot C:\wamp\www\mrbs
</VirtualHost>
<VirtualHost *:80>
  ServerName wiki.def.com
  ServerAlias wiki
  DocumentRoot C:\wamp\www\wiki
</VirtualHost>

Now I am able to access mrbs with the URL : http://mrbs.def.com but
the URL: http://wiki.def.com/wiki is giving me 404 page not found. Please help.
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

Author Comment

by:abguttikonda
ID: 20301120
Sorry for the typo.
The URL : http://wiki.def.com is giving 404 page not found.
0
 
LVL 3

Expert Comment

by:pmctrek
ID: 20311231
What is the main page name? default.html, default.php, index.php,etc?  There is a setting in the httpd.conf that specifies what page to load.  by default apache only loads index.html so find the line

DirectoryIndex index.html index.html.var

and add the index.php to start or end of that line and you should be sorted.
0
 

Author Comment

by:abguttikonda
ID: 20311916
The following is the code under Directory index section of httpd,conf file. Please help if I am missing anything in this.
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.php index.php3 index.html index.htm index.html.var
</IfModule>
#

I can send the httpd.conf file if you wanna take a look at it. Please treat this as urgent.
0
 

Author Comment

by:abguttikonda
ID: 20312337
When I check the apache error log I found the following error log:
[Mon Nov 19 08:51:55 2007] [error] [client a.b.c.d] File does not exist: C:/wamp/www/wiki/wiki
I am clueless why it is pointing to /wiki/wiki it should only point to /wiki
May be this will help you to advise a solution for me.
0
 
LVL 3

Expert Comment

by:pmctrek
ID: 20313038
Hi

it looks like it is looking for a file called wiki and not a folder.. what is the actual file name in the c:\wamp\www\wiki folder?

Paul
0
 
LVL 48

Expert Comment

by:hernst42
ID: 20313088
If you want to acces it via
http://wiki.def.com/wiki
and
http://wiki.def.com/

You need to add for the virtualhost

Alias /wiki C:\wamp\www\wiki

See http://httpd.apache.org/docs/2.2/mod/mod_alias.html
0
 

Author Comment

by:abguttikonda
ID: 20313675
Previously the following is the working link. At that time when I type in wiki.def.com or mrbs.def.com the page that is coming up is wamp main page. From that page when I click on the folder wiki, I was able to get wiki main page, when I click on mrbs I was able to get mrbs main page. Alternatively they were accessible with the URLS : http://wiki.def.com/wiki and http://mrbs.def.com/mrbs
the working link for wiki was http://wiki.def.com/wiki/index.php/Main_Page
I would like to access only via http://wiki.def.com


0
 
LVL 3

Expert Comment

by:pmctrek
ID: 20313782
I have 2 options, the first is a hack and the other is I have installed WAMP locally but you need to tell me which versions of mrbs and wiki you have installed and then I can fix the problem properly.

The hack solution is to alter the DirectoryIndex line to
   DirectoryIndex default.php index.php index.php3 index.html index.htm index.html.var

And then add the file below to your c:\wamp\www\wiki directory just ensuring that the file is named default.php.  This should cause the browser to do an internal site redirection to the wiki Main_Page.

Paul
<? PHP
header ('Location: /index.php/Main_Page');
?>

Open in new window

0
 

Author Comment

by:abguttikonda
ID: 20314098
MRBS 1.2.5, Media wiki 1.11
I have added the code as mentioned above. Now http://wiki.def.com is giving me a blank page.
Please help.
0
 
LVL 3

Accepted Solution

by:
pmctrek earned 2000 total points
ID: 20314248
ok.. I found it.. the problem is with mediawiki not apache or wamp.. I installed the systems exactly the same way you did and everythink worked fine.  Then I set up the virtualhosts and suddenly wiki went nuts.  I just deleted the contents of the wiki directory and wided the database and reinstalled the whole thing using the wiki.def.com url to setup wiki and now it works perfect.

I have compared the two files and the only different I would find was the following

$wgScriptPath       = "/wiki";

in localsettings.php, change this to

$wgScriptPath       = "";

And see what happens.

Paul
0
 

Author Comment

by:abguttikonda
ID: 20316011
Thank you so much. You made my day. Everything works fine now. Once again thak you very much.
0
 

Author Closing Comment

by:abguttikonda
ID: 31409610
Thanks much for the Help, Paul. Really excellent and easy to understand your directions.
0

Featured Post

7 Extremely Useful Linux Commands for Beginners

Just getting started with Linux? Here's a quick start guide that has 7 commands that we believe will come in handy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this article, we’ll look at how to deploy ProxySQL.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question