Solved

Hiding pages without extensions or filename

Posted on 2004-10-26
176 Views
Last Modified: 2010-03-04
Hi,

I am using PHP 4.3.4, Apache 2.0.48 and Redhat 9.

There are many websites that does not seem to have a filename or extension such as .php, .jsp etc. Eg: http://www.domain.com/webpage?string=xx
or some sites even have the filename and extension missing!
Eg: http://www.domain.com/webpage/?string=xx

I would like to know how can i do this on apache and what are the changes i need to make on my scripts.

Thanks
0
Question by:pajiao
    7 Comments
     
    LVL 38

    Expert Comment

    by:yuzh
    use Alias, see http:Q_20776384.html to learn more details
    0
     

    Author Comment

    by:pajiao
    Thanks yuzh,

    The solution will need to specify alias for every page involved and it will be a hassle for huge sites. How can i do it without specifying it manually and getting it to direct by itself?

    thanks
    0
     

    Author Comment

    by:pajiao
    I found a link which does similiar to what i want using mod_rewrite but i need to specify for every page that exists. Is there an dynamic method?

    Here is the link:
    http://www.phpfreaks.com/tutorials/23/0.php
    0
     
    LVL 5

    Accepted Solution

    by:
    You can use RewriteCond to check that request with various extensions is real file or not.
    0
     

    Author Comment

    by:pajiao
    Any examples mrielf?
    0
     
    LVL 38

    Assisted Solution

    by:yuzh
    0
     
    LVL 4

    Assisted Solution

    by:TomDavidson
    ForceType is a way of forceing apache to treat certain files like other file types. In this example:
    http://www.mywebpage.com/myfile would be treated as php

    <Files myfile>
      ForceType application/x-httpd-php
    </Files>

    you can also use wildcards I believe so maybe something like:

    <Files p*>
      ForceType application/x-httpd-php
    </Files>

    would work for you, it would evaluate all file starting with p as php scripts. If you want a more complicated naming convention for your scripts FilesMatch works much the same as files but allow a regular expression match instead.
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    Free Trending Threat Insights Every Day

    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.

    If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
    In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    875 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

    12 Experts available now in Live!

    Get 1:1 Help Now