Reply
Mod-Rewrite Help
Old 03-22-2006, 01:40 PM Mod-Rewrite Help
TimSchroeder's Avatar
Admin/Owner

Latest Blog Post:
RIP eMonetized?
Posts: 6,141
Location: Orlando, FL
Current urls look like this:

siteDotcom/review/index2.php?item_id=13&

but I want them to look like

siteDotcom/review/index2/item_id/13/

I have this in HTaccess:

RewriteEngine On
RewriteRule ^index2/(.*).php /review/index2.php?item_id=$1

php_value error_reporting 2047
php_value display_errors 0

But that didnt change anything. What might I be doing wrong??
__________________
Webmaster-Talk Admin - Forum Rules | Other ePressive Websites: PC Forum |eMonetized Blog
Follow Tim Schroeder on Twitter! | Free Magazines


TimSchroeder is offline
Reply With Quote
View Public Profile Visit TimSchroeder's homepage!
 
When You Register, These Ads Go Away!
Old 03-22-2006, 01:45 PM Re: Mod-Rewrite Help
TimSchroeder's Avatar
Admin/Owner

Latest Blog Post:
RIP eMonetized?
Posts: 6,141
Location: Orlando, FL
Do I need to change anything in the header of the pages in which I want to use modrewrite? I'm new to this...
__________________
Webmaster-Talk Admin - Forum Rules | Other ePressive Websites: PC Forum |eMonetized Blog
Follow Tim Schroeder on Twitter! | Free Magazines


TimSchroeder is offline
Reply With Quote
View Public Profile Visit TimSchroeder's homepage!
 
Old 03-23-2006, 01:25 AM Re: Mod-Rewrite Help
Junior Talker

Posts: 4
if you dont mind me re-directing you,

you should check this tutorial out, is this what you are trying to achieve

http://www.phpfreaks.com/tutorials/23/0.php
Andrus is offline
Reply With Quote
View Public Profile
 
Old 03-23-2006, 06:52 PM Re: Mod-Rewrite Help
Christopher's Avatar
Iced Cap

Latest Blog Post:
PHP and Unicode with UTF-8
Posts: 3,111
Location: Toronto, Ontario
mod_rewrite is an Apache module that handles rewriting on the Apache-level. If you make new rewrite rules, Apache will follow them, but it doesn't change the way that your HTML pages or PHP scripts actually output links. So there are really two steps: first is to create the correct htaccess code to handle rewritten URL's, then to edit your script/template to output URL's in the new format.

I think the htaccess you want is something like this:

Code:
RewriteEngine On
RewriteRule /index2/item_id/([0-9]+)/$ index2.php?item_id=$1
Christopher is offline
Reply With Quote
View Public Profile Visit Christopher's homepage!
 
Old 03-26-2006, 07:14 AM Re: Mod-Rewrite Help
danlefree's Avatar
Skilled Talker

Posts: 61
If your goal is search engine friendliness or usability, it may be preferable to route all 404's to a PHP handler script.

HTACCESS Code:
Code:
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) http://www.your-site.com/index.php
The PHP handler script would then look up the cached (preferable to database calls) content if it exists and serve the page - otherwise the request may be routed to your standard 404 page.
__________________
DAN LEFREE CONSULTING || HADEAN LLC
danlefree is offline
Reply With Quote
View Public Profile Visit danlefree's homepage!
 
Reply     « Reply to Mod-Rewrite Help
 

Thread Tools

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