PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 1st, 2007, 03:21 AM
gc40 gc40 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 39 gc40 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 14 sec
Reputation Power: 12
.htaccess with PHP

Currently, I am using .htaccess rewrite to change some of the names of my URLs. However, I want to take it to another level.

Currently, here is what I have:

RewriteEngine On

RewriteRule ^newsarticle/page/([0-9]+)/?$ newsarticle.php?id=$1

So if my news article was located at: http://www.mydomain.com/newsarticles.php?id=3, it will now be http://www.mydomain.com/newsarticles/page/3

However, I want it a little different.
Rather than ending in with the ID number, I want the URL to have the title.

If the news article title is Cool News Article, then I want the URL to be http://www.mydomain.com/newsarticles/Cool-News-Article

Does anyone know what I would have to do to accomplish this task?

p.s. All news articles are pulled from a database and the title is stored in the field called `title`.

Reply With Quote
  #2  
Old December 1st, 2007, 01:47 PM
Mittineague's Avatar
Mittineague Mittineague is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jul 2005
Location: West Springfield, Massachusetts
Posts: 552 Mittineague User rank is Private First Class (20 - 50 Reputation Level)Mittineague User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 1 m 33 sec
Reputation Power: 14
title instead of id

Maybe
Code:
RewriteRule ^newsarticle/page/([-A-Za-z]+)/?$ newsarticle.php?title=$1
__________________
WP plugins - Error Reporting, Clean Options
http://www.mittineague.com/dev/er.php
http://www.mittineague.com/dev/co.php

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > .htaccess with PHP


Developer Shed Advertisers and Affiliates


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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap