?
Solved

Hiding pages without extensions or filename

Posted on 2004-10-26
7
Medium Priority
?
220 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
Comment
Question by:pajiao
7 Comments
 
LVL 38

Expert Comment

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

Author Comment

by:pajiao
ID: 12419432
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
ID: 12419492
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
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
LVL 5

Accepted Solution

by:
mrielf earned 100 total points
ID: 12421305
You can use RewriteCond to check that request with various extensions is real file or not.
0
 

Author Comment

by:pajiao
ID: 12430294
Any examples mrielf?
0
 
LVL 38

Assisted Solution

by:yuzh
yuzh earned 600 total points
ID: 12430814
0
 
LVL 4

Assisted Solution

by:TomDavidson
TomDavidson earned 300 total points
ID: 12550544
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

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Question has a verified solution.

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

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Free Data Recovery software is an advanced solution from Kernel Tools to recover data and files such as documents, emails, database, media and pictures, etc. It supports recovery from physical & logical drive after a hard disk crash, accidental/inte…
Suggested Courses
Course of the Month3 days, 11 hours left to enroll

601 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