3
Contributors
8
Replies
29
Views
3 Years
Discussion Span
Last Post by rajendher
0

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);

??

Edited by diafol

0

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....

0

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.

0

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

Edited by rajendher

0

.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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.