|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Friendly Tutorial URL's
Hi:
I just finished making my tutorials, but I would like to know if I could make search engine friendly URL's of them, just like on the Codewalkers tutorials. My phpinfo() page is: http://www.coopercentral.org/phpinfo.php 2 things, one, could you tell if I have mod_rewrite enabled so I can re-write the URL's? Two, if I have them enabled, an average URL for my tutorial would look like: /tutorial.php?action=view&id=1&page=1 I would change the id to be the id of the tutorial, and page, to be the page or section of the tutorial. I would like the URL to be like: /tutorial/view/x/y.html Where the x is the tutorial id, and the y is the page number. Could anyone help me out to see if I have URL re-writing capabilities, and if so, help me out with the .htaccess page to make this work. Thanks a lot, I really appreciate it!! PS - THe tutorial.php is in my /public_html directory. Thanks again!! Ken Cooper ---Moved By Postal Cow---- |
|
#2
|
|||
|
|||
|
RE: Friendly Tutorial URL's
Holy non-working website, batman,
I can't get anything to work on your website apart from http://www.coopercentral.org/phpinfo.php. I've tried http://www.coopercentral.org/public_html http://www.coopercentral.org/tutorial http://www.coopercentral.org/tutorial.php http://www.coopercentral.org/tutorial.php?action=view&id=1&page=1 http://www.coopercentral.org/tutorial/view/1/1.html http://www.coopercentral.org/public_html/tutorial.php something gone wrong? What URLs shall I try? ---- Aaaahhh.. I've just re-read your post, and my tests were completely pointless! But, I'll let you see what I did mod_rewrite: looks like it's there. .htaccess: use httpd.conf instead, adding the following: RewriteEngine On RewriteRule /tutorial/(w+)/([0-9]+)/([0-9]+).html$ /tutorial.php?action=$1&id=$2&page=$3 on a global scope. |
|
#3
|
|||
|
|||
|
RE: Friendly Tutorial URL's
I'm very sorry, there was a period (.) that got caught in the URL:
http://www.coopercentral.org/phpinfo.php And my tutorial URL is: http://www.coopercentral.org/tutorial/index.php If the mod_rewrite works out, then I'm going to create another page called tutorial.php off my public_html. Like I said, to view a tutorial, it would look like this: http://www.coopercentral.org/tutorial/index.php?action=view&id=1&page=1 I want it to look like: http://www.coopercentral.org/tutorial/index/view/1/1.html Now could you help me? Thanks a lot, I really appreciate it!! Ken Cooper |
|
#4
|
|||
|
|||
|
RE: Friendly Tutorial URL's
To rewrite
http://www.coopercentral.org/tutorial/index.php?action=view&id=1&page=1 to: http://www.coopercentral.org/tutorial/index/view/1/1.html Add the following to httpd.conf: RewriteEngine On RewriteRule /tutorial/index/(w+)/([0-9]+)/([0-9]+).html$ /tutorial/index.php?action=$1&id=$2&page=$3 (RewriteRule all on one line) |
|
#5
|
|||
|
|||
|
RE: Friendly Tutorial URL's
Here's my question, what if I can't access the httpd.conf file? My server is co-hosted, I don't host it myself. I have my own personal web server, which I test all my scripts on, and I did turn on mod_rewrite, but is there anything else I can do to make this work? Like I said, I can't write to my httpd.conf file? Maybe an .htaccess file? Thanks a lot!!
Ken Cooper |
|
#6
|
|||
|
|||
|
RE: Friendly Tutorial URL's
hmmm...
.htaccess instead of httpd.conf: As far as I know (which is as far as I can throw a pregnant donkey), you can. According to apache mod_rewrite documentation: --snip Unbelievably mod_rewrite provides URL manipulations in per-directory context, i.e., within .htaccess files, although these are reached a very long time after the URLs have been translated to filenames. It has to be this way because .htaccess files live in the filesystem, so processing has already reached this stage. In other words: According to the API phases at this time it is too late for any URL manipulations. To overcome this chicken and egg problem mod_rewrite uses a trick: When you manipulate a URL/filename in per-directory context mod_rewrite first rewrites the filename back to its corresponding URL (which is usually impossible, but see the RewriteBase directive below for the trick to achieve this) and then initiates a new internal sub-request with the new URL. This restarts processing of the API phases. Again mod_rewrite tries hard to make this complicated step totally transparent to the user, but you should remember here: While URL manipulations in per-server context are really fast and efficient, per-directory rewrites are slow and inefficient due to this chicken and egg problem. But on the other hand this is the only way mod_rewrite can provide (locally restricted) URL manipulations to the average user. --snip best to look at: http://httpd.apache.org/docs/misc/rewriteguide.html |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Server Administration > Friendly Tutorial URL's |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|