- This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
Viewing 11 posts - 1 through 11 (of 11 total)
- The forum ‘Other’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
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
If they type in `example.com/index.php`, wouldn’t the `.php` end up being removed because of the htaccess?
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
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`
that’s exactly what i would have the .htaccess to do, if it’s possible ;-)
That’s not what is happening from the htaccess code I gave you in your other post? Can we see a live link?
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
Do you have mod rewrite allowed in Apache?
hmm, do you know where i can check that ? :D
+ 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.
it seems to work now, thanks for your help and your time ;)