Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other no access if .php

  • This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #45802
    cssmann
    Participant

    Hello again, i want to make that, if the user type http://example.com/index.php in the url bare, that .php shows an error or maybe an images, and if it is http://example.com/index it shows the real page. I wan’t this because i don’t want the .htaccess to make to names for the same site.

    i have this in my .htaccess file.

    RewriteEngine On
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteRule ^([^.]+)$ $1.php [NC,L]

    This change the http://example.com/index.php to http://example.com/index.

    Thanks in advance :-D

    #140121
    chrisburton
    Participant

    If they type in `example.com/index.php`, wouldn’t the `.php` end up being removed because of the htaccess?

    #140122
    cssmann
    Participant

    you are right, but is there a way where i only can show the http://example.com/index and the same if people type ind http://example.com/index.php in the url bar? :D

    #140124
    chrisburton
    Participant

    That’s my point. The user should never see the `.php` extension. Even if they type it in, it will be `index` but still show the data from `index.php`

    #140125
    cssmann
    Participant

    that’s exactly what i would have the .htaccess to do, if it’s possible ;-)

    #140126
    chrisburton
    Participant

    That’s not what is happening from the htaccess code I gave you in your other post? Can we see a live link?

    #140127
    cssmann
    Participant

    Right now i test it in localhost, but if the user in the url bar type .php after the /index then they come to the same page, but i don’t think it’s a problem. The only thing i don’t understand is why the .htaccess makes something like 2 pages for every page. One with .php and one with out, but you need to type in .php before it shows? :-D

    #140128
    chrisburton
    Participant

    Do you have mod rewrite allowed in Apache?

    #140129
    cssmann
    Participant

    hmm, do you know where i can check that ? :D

    #140130
    chrisburton
    Participant

    + Left click on the `W` icon of Wamp
    + Hover `Apache`
    + `Apache Modules`
    + Scroll down till you see `rewrite_modules`, is it checked? If not, click on it.

    #140134
    cssmann
    Participant

    it seems to work now, thanks for your help and your time ;)

Viewing 11 posts - 1 through 11 (of 11 total)
  • The forum ‘Other’ is closed to new topics and replies.