PHP Pagination Confusion - php

I'm not asking for a whole engine of code. I'm working on a blog/magazine website. Here are the 2 styles of paginations. I see people use these types of addresses:
example.com/browse?page=100
example.com/page/100/
I understand 1.'s. But, 2. doesn't give me an impression of php usage in the address.
I did a search on Google, but there are only helps on 1. How do you manage 2.? Because whenever you write a new article, you have to push the content throughout every html? Did they use "fake addresses"? because I tried example.com/page/100/index.html and there is no such website.
Can anyone point me to a webpage or explain to me how did they manage 2. style of pagination? Which has a better UX?
Sorry if this is a bad title. Please help me edit and ask me if anywhere isn't clear.

It's URL Rewriting that is responsible or translating nice-looking Urls to their 'real' path on the server.
In your case,
www.example.com/page/100/
might be rewritten on the server to something like
www.example.com/browse.php?page=100
More info:
mod_rewrite for Apache
Url Rewrite for IIS

Related

What is "&ct=ga"? - Help an SEO determine if URLs containing parameter needs to be redirected

I am not a developer, just an SEO working with developers.
We are seeing a lot of "&ct=ga" which are all generating a 404 status code. I want to clear these out but before I redirect, does anyone know what it is?
I did a bit of research and it may be connected to some kind of feed (3rd party or Google News). I didn't know if it could be related to Google Analytics (which we use on the site).
So my question is:
What is this?
Is it safe to do a 301 redirect on URLs with this parameter back to the original URL?
Thank you!
Your developers can probably figure out more based on the context. A grep through the PHP code base for $_REQUEST['ct'] or $_GET['ct'] should hopefully find something that they can latch onto. Alternatively, if the code is based on a framework, there may be a framework-specific way of getting parameters in the code, in which case they'll want to search for that syntax instead.

Purpose of replacing .php with .html extension through .htaccess file

I was reading a little about .htaccess file and I found that it's possible to change .php in the url to .html
But I do not understand what the point of doing it is or what it tries to achieve.
Please note that i'm a beginner with .htaccess also I've searched for that on Google but I didn't found what i'm looking for
There is an ever ongoing battle between seo friendly url's and not. It all depends on the very purpose of your site. If for an example you have a script with dynamic pages like search script or generator of some type (very broad , right ? ;) ) then if your url looks like this:
domain.tld/products?id=183
Rather than
domain.tld/products|183.html
then I don't think there is any better than .php, it's still dynamic and SE will discover that but if you have blog then you might consider a proper wording in url instead of id's. I can think of only one reason apart from what SE' see. What your viewer/surfer sees. I think if he quickly glance at domain.tld/date/rather-simple-title then he might be more interested than in id=183. Now if the url has extension domain.tld/date/rather-simple-title.php or domain.tld/date/rather-simple-title.html in my humble opinion there's no impact on either SE or your website visitor.
Pure theory and rather opinion based conversation here, like the question.

I like to change my id number to my post title in php

I am using this function in php
http://domain.com/page.php?do=post&id=124
but i wish to change this URL to
http://domain.com/page.php/this is first post.html
How can I change this URL?
You need to have knowledge of .htaccess to accomplish this.
What you need to achieve here is URL Rewriting.
What is "URL Rewriting"?
Most dynamic sites include variables in their URLs that tell the site
what information to show the user. Typically, this gives URLs like the
following, telling the relevant script on a site to load product
number 7.
http://www.pets.com/show_a_product.php?product_id=7 The problems with
this kind of URL structure are that the URL is not at all memorable.
It's difficult to read out over the phone (you'd be surprised how many
people pass URLs this way). Search engines and users alike get no
useful information about the content of a page from that URL. You
can't tell from that URL that that page allows you to buy a Norwegian
Blue Parrot (lovely plumage). It's a fairly standard URL - the sort
you'd get by default from most CMSes. Compare that to this URL:
http://www.pets.com/products/7/ Clearly a much cleaner and shorter
URL. It's much easier to remember, and vastly easier to read out. That
said, it doesn't exactly tell anyone what it refers to. But we can do
more:
You can find more information here.
You have to perform url rewriting. Its a technique for you you need to configure your .htaccess file.
Check this for Details

Friendly subfolder link to page (wikipedia style)

I am struggling to find this as I'm not sure exactly what I'm looking for!
I've seen that some sites seem to use 'subfolders' as links to pages, e.g. wikipedia.
E.g. Let's say I had a record in a database with a unique title "My Shopping List". I want to be able to navigate to www.mySite.com/my_shopping_list and have it automatically 'forward' to a page showing the relevant record.
I am using IIS and wondering if there's a way I can do it with that, but I may be looking in the wrong place.
This is for a knowledgebase where I might write an article called "how to use a computer" and would like to be able to create a 'friendly' link for users (http://www.mySite.com/how_to_use_a_computer rather than http://www.mySite.com/article.php?ID=123. I will need to be able to create these 'links' dynamically using the title field.
Thank you
EDIT: I am using IIS6
You should use URL Rewrite, the microsoft ressource for this technique is here: http://www.iis.net/download/urlrewrite
In the iss forum the issue about url rewrite in iss < 7 is discussed with some suggestions on software to use.
I don't know which one is best, maybe there are others who know:
http://iirf.codeplex.com/
http://www.isapirewrite.com/
http://urlrewriter.net/
With PHP, you'll need to code URLConf using something like a htaccess file or the manager GUI. You can read ISS docs on URL rewrite to learn how., but as I understand, this is a module you'll have to download separately.
This question also shows how do do it without editing server configuration files or htaccess, but you'll be stuck with a http://example.com/index.php/path/to/view format (where index.php is a real script with the URLConf in it.)
Well some time ago it was used to call 'Friendly URL' or 'FURL', now i see that it's ust Rewrite URL. Look for tutorials for beginners.

PHP CMS web page short URL?

I am buildiig a simple CMS and would like to know how to create short URLs (not the APACHE bit but the PHP bit).
example.com/?page=100
example.com/home/test
How would I interpret the ?page=100 into /home/test (Through select the database, but i couldn't figure out how) I can see if just one level /home/test because you probably can have a zoneID, but when it comes to /home/test/test. I become lost
And how do I parse back the /home/test to the page id.
Plus is there anyone can show a bit idea for the database design as well?
These resources can be useful to you:
https://stackoverflow.com/a/120411/370290
http://www.symfony-project.org/book/1_0/09-Links-and-the-Routing-System
http://codeigniter.com/user_guide/general/urls.html
http://www.phpaddiction.com/tags/axial/url-routing-with-php-part-one/
You need some kind of mod_rewrite for your server side.
That will help you to send route data to index.php (or somewhere else) file without filename in adress string. Than some php file will analyze the route and give correct html.
ok i think you need to definitely need to look at the way you are going to do your routing (through mod_rewrite)..for example
1.you can rewrite the page www.example.com/test to ..www.example.com/index.php?page=test and implement a way of getting page by the page name..and returning an id if a page name exists ..if multiple entries exist then maybe the last modified will be given precedence over the otheers ..you can get the following book CMS Design Using PHP and jQuery helped me alot

Categories