httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Pasher <just...@newmediagateway.com>
Subject Re: [users@httpd] Apache server - Output to the same page whatever request
Date Thu, 09 Oct 2008 21:22:51 GMT
MierMier wrote:
> Hey people, I need your help, thanks in advance!
>
> I have an appche server 2.x. + PHP, And I woundered rather it is possible
> to output the same page (i.e. "a.php") for a request of whatever page.
>
> I will give an examples:
>
> if the client try to reach "/hello/index.php" (which do not really exist in
> the server)
>
> Can apache just tell the client -> I return you that page (/hello/index.php)
> but infact, this page's content is "a.php"'s content.
> wiout 404 Errors and stuff?
>
> Thanks again
>
> Lior.

A RewriteRule that performs an internal rewrite should give you what you 
need

RewriteEngine on
RewriteRule ^/hello/index.php$ /a.php [L]

By default, the rewrite will perform an internal rewrite, as opposed to 
a 301/302 redirect. If the setup is a little more complex than what you 
describe above, then it may require some additional rules (such as 
redirecting a request for ANY arbitrary file that does not exist). You 
can explore the "RewriteCond -f" directive to make it smarter in that case.

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond


-- 
Justin Pasher

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message