Re: Apache server - Output to the same page whatever request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux