Forum Moderators: phranque

Message Too Old, No Replies

Hiding .php please HELP

Please help hiding .php extension

         

akameng

10:48 am on Sep 26, 2007 (gmt 0)

10+ Year Member



My server don't allow me to use
AddType application/x-httpd-php .asp .py .pl
so I have to use the alternative method below

Options +FollowSymlinks
RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_URI}!(^/index\.php$回/securename(.*)回/robots.txt$回/images/(.*))
RewriteRule .* [domain.com...]

RewriteCond %{REQUEST_URI} /securename(.*)
RewriteRule securename index\.php [T=application/x-httpd-php,L]

then:
www.domain.com/securename?page=1 --> www.domain.com/index.php?page=1
the above is work fine, the securename?page=1 works internally as index.php?page=1 but:
1- $_GET method not work
I solved I use $_SERVER['REQUEST_URI'] instead

2- but if some one type www.domain.com/index.php?page=1 works too
I want to hide .php pages completely exclude of securename?

please Help me to solve this because if .php appeares again in my site that's mean PHP is still available, but I want to hide php completely ..

BEST REGARDS

g1smd

6:23 pm on Sep 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



To hide the PHP URLs you can do one of two things:

1. Redirect (301) the PHP URL request to the URL that you want the user to see, or,

2. Rewrite a direct request for any PHP to an internal filepath such as /this.does.net.exist (and you will not have a file there) and let the 404 handler handle it, be serving a 404 error.

rjwmnews

6:51 pm on Sep 26, 2007 (gmt 0)



Review these archived URLs:

[webmasterworld.com...]
[webmasterworld.com...]

Example:

[Original URI]
http://www.example.com/subdirectory/abc123

[.htaccess code]
RewriteRule /subdirectory/([a-z0-9]+) /customers/orders/profile.php?ID=$1 [NC,L]

[Rewritten destination URI]
http://www.example.com/customers/orders/profile.php?ID=abc123

[edited by: jdMorgan at 7:10 pm (utc) on Sep. 26, 2007]
[edit reason] example.com [/edit]

akameng

7:12 pm on Sep 26, 2007 (gmt 0)

10+ Year Member



Thank You very much for those replies
GREAT very GREAT Thank u Thank u
My PROBLEM SOLVED
Now I use:

Options +FollowSymlinks
RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_URI}!(^/index\.php$回/securename(.*)回/robots.txt$回/images/(.*))
RewriteRule .* [domain.com...]

RewriteCond %{REQUEST_URI} /securename(.*)
RewriteRule securename index\.php [T=application/x-httpd-php,L]

#this section added for www.domain.com/index.php to www.domain.com/securename
RewriteCond %{THE_REQUEST} \.php
RewriteRule index\.php securename [L]

#or this
RewriteCond %{THE_REQUEST} \.php
RewriteRule \.php none
ErrorDocument 404 [domain.com...]

very Thanks for all specially for

.:: Webmaster World ::. [webmasterworld.com]

http://www.webmasterworld.com/(.+)