Solved

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

Posted on 2006-06-21
8
840 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
  • 4
  • 2
8 Comments
 
LVL 15

Expert Comment

by:periwinkle
Comment Utility
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
Comment Utility
Or... why not just change the ServerRoot in the httpd.conf file to be /full/path/to/idea_47 ?
0
 

Author Comment

by:polaatx
Comment Utility
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 15

Expert Comment

by:periwinkle
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now