Jump to content

read more links...blog posts


jimfog

Recommended Posts

  • Replies 71
  • Created
  • Last Reply

Top Posters In This Topic

That is impractical you should look for id, that is specific for specific article, if you search for that title for a specific article you would have to allow for combinations that may include that title.

if ingolme is correct then there is no need for an ID.Just take a look at ingol,mes post.

Link to comment
Share on other sites

That's just a method for storing information in querystring, practical information that should be that to retrieve a specific article I.E that includes the id.

 

page1.php?country=USA&state=California&city=San_Diego

 

page1.php?q=USA/California/San_Diego

 

These are methods for storing values in querystring, they do nothing to retrieve an article.

Edited by dsonesuk
Link to comment
Share on other sites

anyway...you are proposing to use an ID.

I still cannot understand how to associate a unique title with an ID.

 

You have to give me an example.

Edited by jimfog
Link to comment
Share on other sites

You need to include id value as querystring in links, use mod rewrite to give friendly URL but STILL! give you access to retrieve id value to show article. The title SHOULD be stored as part of specific article in database, its just a title and should NOT be used to target that specific article because it has a potential to be used again within another pages title and you would need to filter to target the article you were specifically targeting, with id you do not have such a problem.

 

ALWAYS think long term.

Edited by dsonesuk
Link to comment
Share on other sites

You need to include id value as querystring in links, use mod rewrite to give friendly URL but STILL! give you access to retrieve id value to show article. The title SHOULD be stored as part of specific article in database, its just a title and should NOT be used to target that specific article because it has a potential to be used again within another pages title and you would need to filter to target the article you were specifically targeting, with id you do not have such a problem.

 

ALWAYS think long term.

Οk I got your point...nonetheless you must give me an example of how a friendly URL can lead to an URL with an ID.

Theory is good but an example would be better.

Edited by jimfog
Link to comment
Share on other sites

The example has already been given, FIRST you produce the link that GIVES you the ID in querystring, RIGHT! this is the URL WITH ID you want to use, you then use mod rewrite to change the URL in address bar to a more friendly URL, so every time you use this URL it will STILL refer to the original URL WITH.... NOW sit down because this is going to blow your mind, READY i'm sooo excited about this!.... THE SAME querystring with the SAME value, meaning, if you use $_GET['ID']; you will STILL get the VALUE associated that passed querystring name of id. AMAZING isn't it... NEW URL no querystring, but still able to retrieve id value! MAGIC!

Link to comment
Share on other sites

The example has already been given, FIRST you produce the link that GIVES you the ID in querystring, RIGHT! this is the URL WITH ID you want to use, you then use mod rewrite to change the URL in address bar to a more friendly URL, so every time you use this URL it will STILL refer to the original URL WITH.... NOW sit down because this is going to blow your mind, READY i'm sooo excited about this!.... THE SAME querystring with the SAME value, meaning, if you use $_GET['ID']; you will STILL get the VALUE associated that passed querystring name of id. AMAZING isn't it... NEW URL no querystring, but still able to retrieve id value! MAGIC!

let me comment on the above...

You saying that the URL in the link will have an ID and then this will be converted to a friendly URL.I got that...

But the ID is exposed in the HTML source...isn't that a security vulnerability?

(The idea for a friendly URL from the beginning(with no IDs) as I said I got it from here https://taxibeat.com/)

 

Now one last thing....as I understand if we have two links about a corresponding number of blog posts...both of these will have corresponding IDs.

Yes but dont'we need a different rewrite rule for every article/ugly URL in htaccess?

You had answered no...well give me example how one rewrite rule can cover every possible different link(with different IDs each) .

Link to comment
Share on other sites

Security, no because its rewritten to hide the id you will only use the friendly URL, the rewrite rule will look for specific querystring pattern and make necessary change to produce the friendly URL, it will target single querystring name of ID, to change it to whatever you decide, bugs-bunny if you like! the id value is still retrievable, its covered in the example i gave and the link you went to.

Link to comment
Share on other sites

Security, no because its rewritten to hide the id you will only use the friendly URL,...

The ID is hidden in the browser address bar but what about the HTML..the href tag?

The link the user is about to click.

Edited by jimfog
Link to comment
Share on other sites

What about it? Why do you think having any kind of ID is a security risk? How is it a security risk? Is it like some sort of personal ID that no one else is supposed to know? Do you think it's some sort of security risk to your server if people know IDs? If your application is handling IDs in a way that knowing an ID constitutes a security risk, then your application is doing something funky.

Link to comment
Share on other sites

...the example i gave and the link you went to.

what example?

 

Sorry...I am just a little confused,many posts for this topic.

Edited by jimfog
Link to comment
Share on other sites

Ι think that a good alternative to ID is the date...I am going to use this for uniquely identifying a blog article.

Link to comment
Share on other sites

You only want to support one article per day? That's an odd constraint to put on a system. This is why we use unique IDs instead of assuming that some other value will be unique.

Τhe user will be able to see only one full article at a time...I do not see how this is a constraint.

Exactly in the way it is done here https://taxibeat.com/blog/.

Link to comment
Share on other sites

But if you're using the date as a unique ID then a URL with that date in it will only ever point to a single article. If you have 2 articles posted on the same date, how are you supposed to refer to each of them with different URLs if you're using the date as a unique ID? They both have the same date.

 

That Taxibeat site uses a different method, when they save their article part of the data is a URL stub which is used in the URL, so the htaccess rule passes that stub to a PHP script which looks up the article based on the stub. The stubs would be unique in the database.

Link to comment
Share on other sites

That Taxibeat site uses a different method, when they save their article part of the data is a URL stub which is used in the URL, so the htaccess rule passes that stub to a PHP script which looks up the article based on the stub. The stubs would be unique in the database.

At last we have arrived at the most important part of the topic.

So,you are saying that a URL stub is stored in the database.

If that stub comprises of the date and the title,then this is exactly what I intend to do.

Everything else you mention about an htaccess rule pointing to a PHP script that will "grab" the stub is precisely what I am doing here.

 

If the above is indeed the case I do not see how my approach is wrong.

In my case,also, the stub is the date and the title.Combining these two, an article may be uniquely identified.

 

I mean how possible is the case that tho articles have the same date and title.

Link to comment
Share on other sites

Use title, use id, create friendly url domain.com/myblog/mytitle/76 (where 76 is id) to replace querystring ugly url domain.com/myblog/?title=mytitle&id=76, you can use either in href if httaccess setup to rewrite ugly to friendly and refer to ugly in background. Thats alll you need.

Link to comment
Share on other sites

Yes, using both a title and a date is far better than only using a date like you suggested in post 63.

Is there any other way to grab the stub besides a htaccess rewriting?Htaccess is a mess.

Link to comment
Share on other sites

You need to send all of the URLs to a certain page somehow. htacesss is the best way to do that.

You are right.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...