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.

PHP Forum


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



Freelance Jobs

Reply
.htaccess simple URL rewriting
Old 04-28-2010, 04:31 AM .htaccess simple URL rewriting
Skilled Talker

Posts: 50
Trades: 0
I'm having problems with what should be a simple URL rewrite.

This is what i have so far

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ $1.php [L]
RewriteRule ^contact/findadealer/([^/]*)\.html$ contact/findadealer.php?disID=$1 [L]

I want to show a friendly URL for:

/contact/findadealer.php?disID=37

e.g.

/contact/findadealer/37.html

I've tried different combinations in my htaccess file but none seem to work i just keep getting a 404 error.

Hope someone can help.

Cheers

Wayne
HullBorn is online now
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-28-2010, 04:37 AM Re: .htaccess simple URL rewriting
Experienced Talker

Posts: 44
Name: Jonathan Roy
Location: Montreal, Quebec, Canada
Trades: 0
Hi Wayne,

This code should work for what you want to do.

Code:
RewriteEngine on
RewriteRule ^contact/findadealer/([0-9]+)\.html$ contact/findadealer.php?disID=$1 [L]
Let me know!
__________________

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

Last edited by jonroy; 04-28-2010 at 04:38 AM..
jonroy is offline
Reply With Quote
View Public Profile Visit jonroy's homepage!
 
Old 04-28-2010, 04:47 AM Re: .htaccess simple URL rewriting
seventeen's Avatar
Novice Talker

Posts: 6
Trades: 0
you can easily generated your .htaccess at http://www.generateit.net/mod-rewrite/ Try it..
__________________
Be Good Webmaster

Please login or register to view this content. Registration is FREE
seventeen is offline
Reply With Quote
View Public Profile
 
Old 04-28-2010, 04:54 AM Re: .htaccess simple URL rewriting
Skilled Talker

Posts: 50
Trades: 0
Hi jonroy,

I tried what you suggested and i still get the 404 error page. I'm thinking that the mod_rewrite isn't working on the 1and1 hosting.

Thanks

Wayne.
HullBorn is online now
Reply With Quote
View Public Profile
 
Old 04-28-2010, 10:27 AM Re: .htaccess simple URL rewriting
Lashtal's Avatar
wherenomanhasgonebefore

Posts: 680
Name: Lashtal
Trades: 0
I have not had much luck with 1 & 1, there could be some ground to that in lieu of what you're trying to do here.
__________________
Currently Reading:
Please login or register to view this content. Registration is FREE
Lashtal is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to .htaccess simple URL rewriting
 

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 0.17054 seconds with 12 queries