php - Dynamic pages and clean URL conflicts -


I saw some people and saw how other sites could handle it and in fact I did not see anything like a project I'm working on where you can create pages that are linked to another page. This is where my problem is coming.

I'm not sure how to join these pages. I have only thought about two ideas: Note, I am using mod_rewrite to redirect them to a file which takes the page name as a parameter and captures all. The information related to DB and it displays, this is where one issue develops for # 2.

Idea # 1 works and is solid, but I think it is very unattractive and you are not able to see many websites that other pages of that site , Which contains other padded other information in the URL.

They will never exclude any such data, in whose case the pages formatted in this example would be more appropriate. I would like to compare these pages about SO SO Fax or Page, in which the URL is not formatted in this manner.

Idea # 2 looks cleaner, but some issues run on when using Mod_rewrite and creating pages that said.

There are other parts of the site that are connected to it and you can resist if you give the page the same name. For example, website.com/page1 / On 1 page that already exists, but if you want to create a page called page 1, then a struggle will arise.

Then implementing this idea will require you to filter and limit the user's page names, as well as use the names of those times as well as make the feature something unfriendly and Can scratched their head. Also, it seems a bit ugly coding, there is an array of unacceptable page names and it is being investigated against.

Mod_rewrite is a way to redirect something that: RewriteRule ^ ([A-Za-z0- 9 -] +) $ getPage.php? P = $ 1 becomes a bit ugly because it gets a bit greedy, even though it does not have to do except by limiting it.

So does anyone have any insight on any other possible ways to deal with this issue, or how can the implementation of either of the two mentioned different / better?

Thank you.

I have to agree that Idea # 1 (website.com/page/My-Page -Name) It's better to avoid aliasing, and the rest makes the code cleaner (as the rewrite rule just looks at / page /.*). Popular sites that use this technique include Wikipedia ( / wiki / C), everything 2 ( / title / cool + archive) and answer Com ( / theme / extremely beautiful).

Edit: Idea # 2 can work if you separate user pages from the created page in the case. The path part of a URL is case-sensitive, and a rewrite rule can be easily examined. Example:

& lt; - Website's built-in general page

& lt; - User page

& lt; - other user page

I still want to go with # 1 for simplicity and user friendliness, but it saves at least aliasing.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -