hello everybody.........
for example i want to read a 2014.html or 2014.php file like shown below.
http://example.com/myfiles/2014/-dir-/2014.html.

i don't want to show full path. how it is possible anybody please help me.
Big up for reply.........

Member Avatar
diafol

You could do some url rewriting.

You don't say what you want the url to be. I'm assuming that the location of the file is...

example.com/myfiles/2014/-dir-/2014.html

So do you want something like...

example.com/2014/

Or are you after something completely different?

basename($url);

??

you could always use includes to load whatever page you actualy want them to see

actual location of file is example.com/myfiles/2014/2014.html

example.com/2014/ which is also a good idea but

i need to show the url as
1. example.com/myfiles/2014/-dir-/2014.html
2. example.com/myfiles/-dir-/myfiles.html etc....

Member Avatar
diafol

So it seems that you just want to insert -dir- between the containing directory and the file itself. I don't really understand why you'd need to do this though. A url_rewrite or even a "container page" to display include files should suffice, e.g.

`example.com/displayfile.php=?df=2014`

Which could be url_rewritten to

`example.com/show/2014/`

I'm assuming that the directory name and the file 'name' part are the same from your example...

The displayfile.php would have...

$dir = clean($_GET['df']); //clean should be a function to strip any dots and forward slashes etc

$file = $dir . '.html';
$search = 'myfiles/$dir/$file';
if(file_exists($search))
{
    include($search); //displays the file
}

//this means that all html files under myfiles would be publically accessible    

The .htaccess could be:

RewriteEngine On
RewriteRule ^show/([^/]*)/$ /displaypage.php?df=$1 [L]

Again, this is off the top of my head in 5 minutes - so not thoroughly thought through.

sir, i think plesk panel does not support .htaccess. what should i do?

Member Avatar
diafol

.htaccess is for Apache webserver. I would imagine that your site is on a unix server running Apache.

You don't need to access it throught Plesk. You should be able to upload / ftp the file just as you would a php file.