Solved

How do I hide the subdirectory name in the address bar?

Posted on 2006-06-21
8
849 Views
Last Modified: 2008-01-09
This is what I mean:

I have my site installed in the directory IHEA_47, one level below the root of http://ihea.info

So the path to the index page is http://ihea.info/ihea_47/home  (home is just a alias for the homepage).

In my Site5 hosting control panel i put in a redirection so http://ihea.info points to http://ihea.info/ihea_47 

What I want is that when the user arrives at http://ihea.info/ihea_47/home , he or she sees http://ihea.info/home and not the directory name the site installed. All navigation should be as if the site is in root folder.

How do I do that? I thought REDIRECTION would do that, but I keep seeing http://ihea.info/ihea_47 and all my absolute links inside my pages are broken now.

(I wrote the host a few hours ago and no response). They use the Cpanel. PHP running on Apache.
0
Comment
Question by:polaatx
[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
  • 4
  • 2
8 Comments
 
LVL 15

Expert Comment

by:periwinkle
ID: 16959076
Try using an Alias instead:

Alias /home /full/path/to/ihea_47_home

withint hte VirtualHost container for ihea.info.
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 16959088
Or... why not just change the ServerRoot in the httpd.conf file to be /full/path/to/idea_47 ?
0
 

Author Comment

by:polaatx
ID: 16959349
Hello, could you tell me howto do this? where would I find the VirtualHost container ?

Your second idea: I don't think I have access to httpd.conf. I've asked the host by email but they won't answer me. But went through every directory in the root and found nothing.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:periwinkle
ID: 16960194
Unless you have access to restarting the apache web server, you don't have access to the httpd.conf.

Unfortunately, if you don't have access to that, I don't believe that you'll be able to add an Alias to the .htaccess file... but it's worth a try.

You need to create a file called .htaccess and with that line, and stick it in the root of your site.  Be prepared to delete it, though, if it doesn't work, it will render your site unaccessable.  
0
 

Author Comment

by:polaatx
ID: 17022248
Hello, below is my current .htaccess residing in the root.

Could you kindly please tell me the exact code I should put in and where I should put it in.

Do I put in:

Alias /home /full/path/to/ihea_47_home

Is the above exact code or "path" is spaceholder for my particular path?

Here's my htaccess:

#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "(\.(engine|inc|install|module|sh|.*sql|theme|tpl(\.php)?|xtmpl)|code-style\.pl|Entries.*|Repository|Root)$">
  Order deny,allow
  Deny from all
</FilesMatch>

# Set some options.
Options -Indexes
Options +FollowSymLinks

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>

# PHP 4, Apache 2
<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>

# PHP 5, Apache 1 and 2
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>

# Reduce the time dynamically generated pages are cache-able.
<IfModule mod_expires.c>
  ExpiresByType text/html A1
</IfModule>

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # If your site can be accessed both with and without the prefix www.
  # you can use one of the following settings to force user to use only one option:
  #
  # If you want the site to be accessed WITH the www. only, adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
  # RewriteRule .* http://www.example.com/ [L,R=301]
  #
  # If you want the site to be accessed only WITHOUT the www. , adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
  # RewriteRule .* http://example.com/ [L,R=301]


  # Modify the RewriteBase if you are using Drupal in a subdirectory and
  # the rewrite rules are not working properly.
  #RewriteBase /drupal

  # Rewrite old-style URLs of the form 'node.php?id=x'.
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^id=([^&]+)$
  #RewriteRule node.php index.php?q=node/view/%1 [L]

  # Rewrite old-style URLs of the form 'module.php?mod=x'.
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
  #RewriteRule module.php index.php?q=%1 [L]

  # Rewrite current-style URLs of the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

# $Id: .htaccess,v 1.73 2006/04/14 09:08:26 killes Exp $
0
 
LVL 15

Accepted Solution

by:
periwinkle earned 500 total points
ID: 17023550
RE: Alias /home /full/path/to/ihea_47_home
RE: Is the above exact code or "path" is spaceholder for my particular path?


/full/path/to  is a placeholder for your actual path;  for example, if on your server, ihea_47_home is in the /home/ihea/www/ihea_47_home directory, then you would use:

Alias /home /home/ihea/www/ihea_47_home
0

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Suggested Courses

738 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