another mod_rewrite [simple question]
Moderator: General Moderators
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
another mod_rewrite [simple question]
If I have a page at site.com/checkout.php and I have mod_rewrite allowing site.com/checkout and I want to do another mod_rewrite to allow site.com/checkout/1 (or site.com/checkout?step=1 or site.com/checkout.php?site=1) how can I do it without getting a 500 error.
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
Can you show what you have so far?
Code: Select all
RewriteRule ^checkout/$ checkout.php
RewriteRule ^checkout/([0-9]+)$ checkout.php?step=$1
## Very Basic ##- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
What I have so far is...
Code: Select all
#Allows all urls for .php to be /page
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /$1 [R=301,L]
#Hade this but just saw the error...
RewriteRule checkout/([0-9]+{1})$ /checkout.php?step=$1
#changed to this now...
RewriteRule checkout/([0-9]{1})$ /checkout.php?step=$1
#but it still doesn't work?
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
feyd i'm no getting you today. maybe cause its so late.feyd wrote:It would likely do that, with or without it. It was superfluous.
Code: Select all
#Allows all urls for .php to be /page
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /$1 [R=301,L]
RewriteRule checkout/([0-9])$ /checkout.php?step=$1
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
How can I get to the error log when I'm on a shared server, can I change it to a file I can access?superdezign wrote:Try starting the rule with a '/', and be sure that you've set the RewriteBase.
Check your error log to see if the problem is the regex, or if you're referencing an incorrect file (due to the lack of RewriteBase, you'll oftentimes be in the wrong directory and not know).
Most shared servers have it in their cpanel.tecktalkcm0391 wrote:How can I get to the error log when I'm on a shared server, can I change it to a file I can access?superdezign wrote:Try starting the rule with a '/', and be sure that you've set the RewriteBase.
Check your error log to see if the problem is the regex, or if you're referencing an incorrect file (due to the lack of RewriteBase, you'll oftentimes be in the wrong directory and not know).