Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

want a portion of the url

website.com/file.php

want 'file'

and not .php


http://www.site.net/fileName.php

want fileName
Avatar of Cornelia Yoder
Cornelia Yoder
Flag of United States of America image

First use explode() to separate the portions between slashes.
Then use explode() again on the last section to separate the last section at the dot.

Will this format for the url be always so simple?  Or might it be more complex, such as

http://www.xxx.yyy.zzz.com/abc.def.php ?

If so, precisely define the portion you want, and we can find it.

http://us1.php.net/manual/en/function.explode.php
ASKER CERTIFIED SOLUTION
Avatar of Cornelia Yoder
Cornelia Yoder
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lucasnc
lucasnc

The simplest medium would be to add the following code to your .htaccess file.  Once done, you should be able to go to http://example.com/index instead of http://example.com/index.html.

Options +MultiViews

Open in new window

Keep in mind that this will work only in an instance where you don't have two instances of the same file name.  For example, if you have both "index.html" and "index.php", the server will have to make its best guess as to which file you want it to serve up.  If you have a /secure/ directory and a file entitled "secure.html", directories take priority over files, so browsing to http://example.com/secure will bring you to the content of that directory and not http://example.com/secure.html.

Hope this helps.
Avatar of rgb192

ASKER

only using php and not htacess

this solved the problem

thanks