URL Links/Rewrites?

This is a discussion on "URL Links/Rewrites?" within the PHP Forum section. This forum, and the thread "URL Links/Rewrites? are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Feb 3rd, 2008, 13:43
Jack Franklin's Avatar
Moderator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,402
Blog Entries: 8
Thanks: 18
Thanked 14 Times in 14 Posts
URL Links/Rewrites?

Did not know where the best place to put this was so I'll put it here, but please move if needed.

Right now the URLS of Penguin are: single.php?contentid=1 or category.php?category=category or month.php?month=1
When you first use WordPress, it is like that, but you can change it by adding something to the .htaccess file and, I'm presuming that some PHP is involved. Can anyone help me with what to do? I appreciate it is a big task, any help is welcome.

Thanks,

Jack
__________________
Jack Franklin - Webforumz Moderator
(x)HTML | CSS | PHP | MySQL | JQuery (Javascript)
Contact: My Blog | Twitter | Delicious
Want Lessons? PM me.
If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Feb 3rd, 2008, 14:06
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: URL Links/Rewrites?

Okay I was going to write a sticky first but I'll give you some tips.
Here's one for the month:

RewriteRule ^month/([0-9]+)-[a-zA-Z]$ month.php?id=$1 [L]

Which could be accessed via www.example.com/month/2-february
The 2 in the url would be passed to month.php making it month.php?id=2.
Let me know how you get on.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Feb 3rd, 2008, 14:09
Jack Franklin's Avatar
Moderator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,402
Blog Entries: 8
Thanks: 18
Thanked 14 Times in 14 Posts
Re: URL Links/Rewrites?

I just put the .htaccess in the root folder right?
__________________
Jack Franklin - Webforumz Moderator
(x)HTML | CSS | PHP | MySQL | JQuery (Javascript)
Contact: My Blog | Twitter | Delicious
Want Lessons? PM me.
If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Feb 3rd, 2008, 14:13
Jack Franklin's Avatar
Moderator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,402
Blog Entries: 8
Thanks: 18
Thanked 14 Times in 14 Posts
Re: URL Links/Rewrites?

Alex, I upload the .htaccess and navigate to http://www.jackfranklin.co.uk/month/2-february and no luck. The htaccess is:
Code: Select all
RewriteRule ^month/([0-9]+)-[a-zA-Z]$ month.php?id=$1 [L]
Ignore the 404 by the way, I did that about 2 years ago lol.
__________________
Jack Franklin - Webforumz Moderator
(x)HTML | CSS | PHP | MySQL | JQuery (Javascript)
Contact: My Blog | Twitter | Delicious
Want Lessons? PM me.
If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Feb 3rd, 2008, 14:22
Marc's Avatar
Staff Manager

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Posts: 1,777
Thanks: 0
Thanked 15 Times in 15 Posts
Re: URL Links/Rewrites?

You'll need to create the clean URL in the PHP that looks like http://www.jackfranklin.co.uk/month/2-february
__________________
Marc
Staff Manager - Webforumz.com


Want to be a moderator? PM me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Feb 3rd, 2008, 14:23
Jack Franklin's Avatar
Moderator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,402
Blog Entries: 8
Thanks: 18
Thanked 14 Times in 14 Posts
Re: URL Links/Rewrites?

Sorry? I dont understand Mark. Could you give me an example?
__________________
Jack Franklin - Webforumz Moderator
(x)HTML | CSS | PHP | MySQL | JQuery (Javascript)
Contact: My Blog | Twitter | Delicious
Want Lessons? PM me.
If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Feb 3rd, 2008, 14:25
Marc's Avatar
Staff Manager

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Posts: 1,777
Thanks: 0
Thanked 15 Times in 15 Posts
Re: URL Links/Rewrites?

PHP: Select all

$notAllowed = array("!"","".""[""]"">""<"";""&""^""%""$""£""@"'"'"#""~""*("")""\"");
    
$cleanerTitle str_replace($notAllowed""$row['title']);
    
$cleanTitle str_replace(" ""-"strtolower($cleanerTitle)); 
That is me creating my CLEAN URL.
__________________
Marc
Staff Manager - Webforumz.com


Want to be a moderator? PM me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Feb 3rd, 2008, 14:27
Jack Franklin's Avatar
Moderator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,402
Blog Entries: 8
Thanks: 18
Thanked 14 Times in 14 Posts
Re: URL Links/Rewrites?

I'm sorry but I still have no idea what I need to do to make the re-write work.
__________________
Jack Franklin - Webforumz Moderator
(x)HTML | CSS | PHP | MySQL | JQuery (Javascript)
Contact: My Blog | Twitter | Delicious
Want Lessons? PM me.
If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Feb 3rd, 2008, 14:31
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: URL Links/Rewrites?

Is that all your htaccess contains? You need to turn on the rewrite engine with this at the top of your htacces:
Code: Select all
RewriteEngine on
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Feb 3rd, 2008, 14:32
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: URL Links/Rewrites?

Quote:
Originally Posted by Marc View Post
PHP: Select all

$notAllowed = array("!"","".""[""]"">""<"";""&""^""%""$""£""@"'"'"#""~""*("")""\"");
    
$cleanerTitle str_replace($notAllowed""$row['title']);
    
$cleanTitle str_replace(" ""-"strtolower($cleanerTitle)); 
That is me creating my CLEAN URL.
Marc, he needs to get the rewrite to actually work before he can create the links dynamically.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Feb 3rd, 2008, 14:33
Jack Franklin's Avatar
Moderator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,402
Blog Entries: 8
Thanks: 18
Thanked 14 Times in 14 Posts
Re: URL Links/Rewrites?

I've added that, but the same problem still.
__________________
Jack Franklin - Webforumz Moderator
(x)HTML | CSS | PHP | MySQL | JQuery (Javascript)
Contact: My Blog | Twitter | Delicious
Want Lessons? PM me.
If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old Feb 3rd, 2008, 15:03
Jack Franklin's Avatar
Moderator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,402
Blog Entries: 8
Thanks: 18
Thanked 14 Times in 14 Posts
Re: URL Links/Rewrites?

So, it's not working at all. I've checked the .htaccess file. Would it be something with my hosts?
__________________
Jack Franklin - Webforumz Moderator
(x)HTML | CSS | PHP | MySQL | JQuery (Javascript)
Contact: My Blog | Twitter | Delicious
Want Lessons? PM me.
If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13  
Old Feb 3rd, 2008, 15:20
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: URL Links/Rewrites?

You got this in there also?
Code: Select all
Options +FollowSymLinks

Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14  
Old Feb 3rd, 2008, 16:19
Jack Franklin's Avatar
Moderator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,402
Blog Entries: 8
Thanks: 18
Thanked 14 Times in 14 Posts
Re: URL Links/Rewrites?

Have now. Still nothing happening though.
__________________
Jack Franklin - Webforumz Moderator
(x)HTML | CSS | PHP | MySQL | JQuery (Javascript)
Contact: My Blog | Twitter | Delicious
Want Lessons? PM me.
If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #15  
Old Feb 3rd, 2008, 16:55
Marc's Avatar
Staff Manager

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Posts: 1,777
Thanks: 0
Thanked 15 Times in 15 Posts
Re: URL Links/Rewrites?

Quote:
Originally Posted by alexgeek View Post
Marc, he needs to get the rewrite to actually work before he can create the links dynamically.
I was just saying in General..
__________________
Marc
Staff Manager - Webforumz.com


Want to be a moderator? PM me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #16  
Old Feb 3rd, 2008, 20:28
Highly Reputable Member
Join Date: Dec 2006
Location: Norwich
Posts: 721
Blog Entries: 4
Thanks: 6
Thanked 2 Times in 2 Posts
Re: URL Links/Rewrites?

Its not working because jack has no http://www.jackfranklin.co.uk/month.php on his server
Last Blog Entry: Whats your Niche? (Jun 10th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply