Server Administration
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesServer Administration

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old August 5th, 2003, 10:44 PM
Coopercentral Coopercentral is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 224 Coopercentral User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to Coopercentral
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----

Reply With Quote
  #2  
Old August 8th, 2003, 10:55 AM
shiraz shiraz is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Leics, UK
Posts: 31 shiraz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 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.

Reply With Quote
  #3  
Old August 8th, 2003, 11:33 AM
Coopercentral Coopercentral is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 224 Coopercentral User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to Coopercentral
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

Reply With Quote
  #4  
Old August 8th, 2003, 12:41 PM
shiraz shiraz is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Leics, UK
Posts: 31 shiraz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
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)

Reply With Quote
  #5  
Old August 8th, 2003, 12:56 PM
Coopercentral Coopercentral is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 224 Coopercentral User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to Coopercentral
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

Reply With Quote
  #6  
Old August 8th, 2003, 01:33 PM
shiraz shiraz is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Leics, UK
Posts: 31 shiraz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
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

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesServer Administration > Friendly Tutorial URL's


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway