Forum Moderators: coopster
I tested the script using a different filename (listit.php) together with the parameter
wwWebmasterWorldebsite.dom/listit.php/mysingleparameter
this works ok.
but when I renamed the listit.php to index.php, it doesn't work anymore when I use
wwWebmasterWorldebsite.dom/mysingleparameter
but if I use
wwWebmasterWorldebsite.dom/index.php/mysingleparameter
it was ok.
is there a solution for this?
I'd like the URL to be as short as possible so I want to eliminate the need to add index.php or filename.php
Thanks in advance.
In the case of
wwWebmasterWorldebsite.dom/mysingleparameter
the dirname is wwWebmasterWorldebsite.dom
the basname is mysingleparameter
but in the case of
wwWebmasterWorldebsite.dom/index.php/mysingleparameter
the basename is the same, but the dirname is now
wwWebmasterWorldebsite.dom/index.php
What you get depends on what you do. In other words, say you're doing something like
include($parts['dirname']);
The problem is that you would need to make sure that the "directory" is actually a file.
wwWebmasterWorldebsite.dom/index.php - is a file
wwWebmasterWorldebsite.dom - is not
That's Easy.
For example this following code , if put in a .htaccess file will send all .htm and .html requests to your index.php like this
RewriteEngine On
RewriteRule ^([^/]+)/?\.htm$ index.php?page=$1 [L]
RewriteRule ^([^/]+)/?\.html$ index.php?page=$1 [L]
For example if someone types
yourdomain.com/wow-this-is-a-test-page.html
and the page wow-this-is-a-test-page.html doesnt exist what this .htaccess will do is that it will take that
"wow-this-is-a-test-page.html"
and send it to your index.php as a parameter named "page"
so it will hiddenly change like
yourdomain.com/index.php?page=wow-this-is-a-test-page
and in your index.php you can easily put conditions on what do show on what page request. this way your urls will be too much friendly then simple "?this=that" thing.
This is just an example.. way more in it.
Thanks
Kami
I saw line like this inside the .htaccess
RewriteCond %{HTTP_REFERER}!^http://somewebsite.dom/.*$ [NC]
then the last line says :
RewriteRule .*\.(jpg¦jpeg¦gif¦png¦bmp)$ - [F,NC]
where do I insert those lines that you mentioned?
another thing is, it's not htm or html, it's actually a username
so people will type :
www.somewebsite.dom/username
then the "username" will be processed and they'll be redirected to their page.
Thank you very much for the help.