Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Old 06-19-2005, 08:48 AM mod_rewrite help
Python's Avatar
Ultra Talker

Latest Blog Post:
A new site is launched
Posts: 374
Trades: 0
im trying to make my site's dynamic url's search engine friendly But Im having a bit of a problem...

Here is what is in my .htaccess file:
Code:
RewriteEngine On
RewriteRule ^(tutorials)/$ /tutorials.php [L]
RewriteRule ^(tutorials)$ /tutorials.php [L]
RewriteRule ^tutorials/(.*)/$ /tutorials.php?c=$1 [L]
RewriteRule ^tutorials/(.*)$ /tutorials.php?c=$1 [L]
RewriteRule ^tutorials/(.*)/(.*)/$ /tutorials.php?c=$1&t=$2 [L]
RewriteRule ^tutorials/(.*)/(.*)$ /tutorials.php?c=$1&t=$2 [L]
This are what I want it to do:

domain.com/tutorials.php >> domain.com/tutorial - this works
domain.com/tutorials.php?c=4 >> domain.com/tutorial/4 - this works
domain.com/tutorials.php?c=4&t=5 >> domain.com/tutorial/4/5 - this doesnt work

The one which doesnt work works fine when its not uring mod_rewrite therefore the coding must be right...
Any ideas?

Thanks
__________________

Please login or register to view this content. Registration is FREE

- Affordable web site design solutions
Python is offline
Reply With Quote
View Public Profile Visit Python's homepage!
 
 
Register now for full access!
Old 06-20-2005, 09:19 AM
Python's Avatar
Ultra Talker

Latest Blog Post:
A new site is launched
Posts: 374
Trades: 0
Please anyone?
__________________

Please login or register to view this content. Registration is FREE

- Affordable web site design solutions
Python is offline
Reply With Quote
View Public Profile Visit Python's homepage!
 
Old 06-20-2005, 03:17 PM
Rufo's Avatar
Extreme Talker

Posts: 173
Trades: 0
In the pattern (.*) the . can stand for a forward slash. I'm guessing this is what has happened:

domain.com/tutorial/4/5/
$1 = "4/5"
$2 = ""
domain.com/tutorials.php?c=4/5&t=

Try something like:
Code:
RewriteRule ^tutorials/([^/]*)/([^/]*)$ /tutorials.php?c=$1&t=$2 [L]
RewriteRule ^tutorials/([^/]*)/([^/]*)/$ /tutorials.php?c=$1&t=$2 [L]
which matches anything other than a forward slash. Alternatively, use a pattern which matches only a single digit.


Rufo
__________________

Please login or register to view this content. Registration is FREE
Rufo is offline
Reply With Quote
View Public Profile Visit Rufo's homepage!
 
Old 06-20-2005, 06:50 PM
Python's Avatar
Ultra Talker

Latest Blog Post:
A new site is launched
Posts: 374
Trades: 0
Nope that didnt work...

Im beginning to think that it could be a problem with my PHP code.

But it shouldnt be because using it the dynamic way works fine which means it must be getting the $t variable value therfore using the dynamic way its as if it cant get the value of $t
__________________

Please login or register to view this content. Registration is FREE

- Affordable web site design solutions
Python is offline
Reply With Quote
View Public Profile Visit Python's homepage!
 
Old 06-21-2005, 05:37 PM
Rufo's Avatar
Extreme Talker

Posts: 173
Trades: 0
You could pass the two numbers to PHP as a string, then split them up using explode().
__________________

Please login or register to view this content. Registration is FREE
Rufo is offline
Reply With Quote
View Public Profile Visit Rufo's homepage!
 
Old 07-04-2005, 08:38 PM
Python's Avatar
Ultra Talker

Latest Blog Post:
A new site is launched
Posts: 374
Trades: 0
Its ok.. problame solved

See it working at www.devdreams.com
__________________

Please login or register to view this content. Registration is FREE

- Affordable web site design solutions
Python is offline
Reply With Quote
View Public Profile Visit Python's homepage!
 
Old 07-05-2005, 07:56 AM
ibbo's Avatar
Super Spam Talker

Posts: 880
Location: Leeds UK
Trades: 0
Nice to show here what you did to make it work,

ibbo
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Linux user #349545 :
(GNU/Linux)iD8DBQBAzWjX+MZAIjBWXGURAmflAKCntuBbuKCWenpm XoA7LNydllVQOwCf
ibbo is offline
Reply With Quote
View Public Profile Visit ibbo's homepage!
 
Old 07-05-2005, 06:09 PM
Python's Avatar
Ultra Talker

Latest Blog Post:
A new site is launched
Posts: 374
Trades: 0
Oh rite sorry...
Well basically I changed the script itself so that when it accesses a tutorial it doesnt use the category variable at all....

So ive now got this for tutorial categories:

http://www.devdreams.com/tutorials/c/4
http://www.devdreams.com/tutorials/c/6

And this for the actual tutorials:

http://www.devdreams.com/tutorials/t/38
http://www.devdreams.com/tutorials/t/33
__________________

Please login or register to view this content. Registration is FREE

- Affordable web site design solutions
Python is offline
Reply With Quote
View Public Profile Visit Python's homepage!
 
Reply     « Reply to mod_rewrite help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.20451 seconds with 12 queries