Can I get a list of files on any page?
For example on page
www.90minut.pl/
Every news on page is in folder "news" eg.
www.90minut.pl/news/238/news2387307-Deniz-Yilmaz-nie-zagra-z-Legia.html
I would like to see all files on
www.90minut.pl/news/
Is it possible in PHP?
No.
Unless the site provides you with links, there is no way to tell what resources it is hosting.
of course you can, but, you have to pay attention if the structure from the website/system is using structure like MVC or it's using friendly urls, and the server's permission it's setted as read mode or read/write.
Related
I'm new to web development but i know some php basic stuff. Using ftp, i create directories then create simple php scripts there, simple as echoing a string. Which can be accessed like,
www.sampledomain.com/folder1/subfolder2/hello.php
After some time, my friend introduced me to wordpress which is what they described as CMS. I tried to visit her site www.majaflores.com then i click on some stuff there and i noticed the url changed to http://majaflores.com/project/if-i-let-you-in-please-dont-break-anything/
At first, its pretty normal for me because its just a link where there is a folder named "project" and inside it another folder named "if-i-let-you-in-please-dont-break-anything". But when she showed me the ftp folders directory, i didnt see any folder named "project" under main folder of the domain. How did wordpress manage to do this? and how can i implement this manually?
Just wanted to say that like most server-side code environments, PHP also let you parse URLs "manually" and decide what to do accordingly, be it return a file or generate some content.
You can find more information about how PHP is parsing URLs in here:
http://php.net/manual/en/function.parse-url.php
and some discussion regarding it in here:
URL handling – PHP vs Apache Rewrite
This is they way WordPress stores data. U can further see the setting under Permalink.
Under Permalink, u can have options to render ulr as page id, category names and more. You can also use your own format over there.
Just a note, WordPress stored data in database not as a content on FTP directory.
I'm building some kind of social-network site using PHP and mysql (and quite new to web development..). I want user profiles to be accessible trough the URL address as "http://www.example.com/username".
It is also very important to me that each profile page will be indexed by search engines.
How do I do this?
You need to use .htaccess - mod_rewrite to be more specific
You can find many resources online for this.
I am somehow confused to analyse a project. Client says "I need an admin panel using PHP that create subdomain on wizard", i.e like he wants www.domain.com/sub1, www.domain.com/sub2, www.domain.com/sub3 etc. each sub domain may contain different header, menu, content, footer etc. I am really confused in "How do I make PHP admin panel that creates a directory and files for each subdomain?". I hope you got it, otherwise I am ready to discuss it more.
Thanks.
Hope you have something on this:
http://php.net/manual/en/function.mkdir.php
http://php.net/manual/en/function.fwrite.php
Why making a directory for each "domain"? You can use .htaccess and a database.
I have a revision website, it has stuff for multiple school subjects. I am starting to develop subject pages, these will have stuff only for that subject. e.g. a physics page
Anyway, what I am trying to do is let people type in www.myWebsite.com/history or www.myWebsite.com/ict - or what ever. And them get redirected to the appropriate page.
From that it sounds really simple, I would just put a file called history.php in my public_html home directory, right?
But my home directory is super organised, with everything in nice sub folders. I want to but all the subject pages in a sub folder called 'subjects' (imaginative name :p ).
How can I put these pages in the sub folder, yet still let the user access them from the URL examples above?
A great way to do this is to use a Front Controller. You can re-route all requests to one file (typically index.php) via htaccess and then from there grab the URI (the /itc, /history etc.) and use it to direct the request to the appropriate script.
Check this out, should get you started.
http://www.technotaste.com/blog/simple-php-front-controller/
Once you figure that out, you will want to compare the differences between dynamic and static invocation. Cheers.
you've got to do a url rewrite for the same. google out mod_rewrite and you'll get the examples.
If you are running under Apache, mod_rewrite is probably the most direct approach to accomplishing this.
http://httpd.apache.org/docs/current/mod/mod_rewrite.html
Basically create a .htaccess file in the root that maps the URI segment to the appropriate php file in your 'subjects' directory.
I think this is a case where you could use mod_rewrite, so the web server you're using will redirect the user to the appropiate directory. You can either keep the rewrite list manually or dynamically using regexes.
In MyBB forums you must have seen that all those threads are stoed as forum.com/Thread-Name-of-the-thread
So now this is static right ?
So now i have a site which has
blog.com/search.php?=SEARCHED+TEXT
So now how do i save this search so that Google can find out this page on my site ?
Indirectly what i mean to say is how i can i make
blog.com/SEARCHED+TEXT.html
"So now this is static right?" No. Just because the URL doesn't end in .php or similar doesn't mean it's static. It's time for you to learn the wonders of mod_rewrite:
http://www.workingwith.me.uk/articles/scripting/mod_rewrite
Your first example isn't static at all. It's just using a tool to route the request based on the URL.
All you need to get the same functionality is to investigate URL Routing in PHP and implement it in your application as well.
If you want Google to index this search page you have to tell Google it exists, either through a Sitemap or by putting a link on your site that Google can crawl. Google did fill in forms in the past, but I am not sure if they still do and afaik, they only did on a selected few sites.
To make the search static, you have to render the page once and store it in a file. Whether you do that manually by simply calling up the file in your browser and then saving it or by means of a Caching System is up to you.