NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Htaccess - What have I done Wrong in my code?

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Reply
 
LinkBack Thread Tools
Old 06-18-2009, 07:10 AM THREAD STARTER               #1 (permalink)
NamePros Regular
 
ridesign1's Avatar
Join Date: Mar 2005
Posts: 867
ridesign1 has a spectacular aura aboutridesign1 has a spectacular aura about
 



Lightbulb Htaccess - What have I done Wrong in my code?


I have a page http://www.site.com/new

1)I want to redirect http://www.site.com/new/1/
to : http://www.site.com/new?pg=1

2)And redirect http://www.site.com/new/cat/2/
to : http://www.site.com/new?c=cat&pg=2

3)And redirect http://www.site.com/new/cat/
to : http://www.site.com/new?c=cat
????: NamePros.com http://www.namepros.com/programming/590765-htaccess-what-have-i-done-wrong.html

I have attempted the following 1 and 2 work but 3 does not work:
"c" will always be small letters and "pg" will be between 1-5.


Code:
RewriteRule ^new/([a-z])/$ /new/?c=$1 [L]
RewriteRule ^new/(.*)/([0-9])/$ /new/?c=$1&pg=$2 [L]
RewriteRule ^new/([0-9])/$ /new/?pg=$1 [L]
ridesign1 is offline   Reply With Quote
Old 06-18-2009, 08:24 AM   #2 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
I don't know much about .htaccess, but is that your entire .htaccess file? Don't forget to turn RewriteEngine On.
mholt is offline   Reply With Quote
Old 06-18-2009, 08:48 AM THREAD STARTER               #3 (permalink)
NamePros Regular
 
ridesign1's Avatar
Join Date: Mar 2005
Posts: 867
ridesign1 has a spectacular aura aboutridesign1 has a spectacular aura about
 



no sorry , that is just a section of it.
yes have got that to turn on rewrite
ridesign1 is offline   Reply With Quote
Old 06-18-2009, 09:23 AM   #4 (permalink)
NamePros Regular
 
qbert220's Avatar
Join Date: Jul 2007
Location: UK
Posts: 395
qbert220 is a splendid one to beholdqbert220 is a splendid one to beholdqbert220 is a splendid one to beholdqbert220 is a splendid one to beholdqbert220 is a splendid one to beholdqbert220 is a splendid one to beholdqbert220 is a splendid one to behold
 


Protect Our Planet
You want:

Code:
RewriteRule ^new/([a-z]+)/$ /new/?c=$1 [L]
qbert220 is offline   Reply With Quote
Old 06-18-2009, 09:48 AM THREAD STARTER               #5 (permalink)
NamePros Regular
 
ridesign1's Avatar
Join Date: Mar 2005
Posts: 867
ridesign1 has a spectacular aura aboutridesign1 has a spectacular aura about
 



what does the + do?
do i need to add the + for ([0-9]+)?

Should this work?

RewriteRule ^new/([a-z]+)/([0-9]+)/$ /new/?c=$1&pg=$2 [L]
ridesign1 is offline   Reply With Quote
Old 06-18-2009, 02:33 PM   #6 (permalink)
NamePros Regular
 
qbert220's Avatar
Join Date: Jul 2007
Location: UK
Posts: 395
qbert220 is a splendid one to beholdqbert220 is a splendid one to beholdqbert220 is a splendid one to beholdqbert220 is a splendid one to beholdqbert220 is a splendid one to beholdqbert220 is a splendid one to beholdqbert220 is a splendid one to behold
 


Protect Our Planet
The "+" mean match one or more of the previous element (in this case one or more letters). Without the "+" the pattern will only match a single letter between the slashes. With the "+" it will match one or more letters between the slashes. You don't need it after the [0-9] since you only expect a single digit.
qbert220 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
invitation code TNX.net and 1000 free backlinks Boer94 Link Exchange Requests 0 08-31-2008 03:08 AM
lots of chinese IDNs for sale cougarmax IDN Domains For Sale 0 06-02-2006 08:07 AM
Area Code Scam - Must Read! sbaik Warnings & Alerts 9 05-19-2006 06:52 PM
Website and Application Content Databases odditysoftware Content For Sale 8 01-20-2006 05:34 AM
Basic HTML Tutorial webgear Webmaster Tutorials 8 04-02-2005 03:20 PM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 08:07 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger