Jump to content

Recommended Posts

Hey all.

 

I am just stumped and cannot figure out what I am doing wrong.  I thought I understood the basics of mod_rewrite and rewrite rules as I did a pretty bangup job on another site.  But, now, I cannot get the rules to work on a new site.

 

Here is what I have going on in my .htaccess:

 

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^buy-wow-account/account/([0-9]+)/$ /character.php?acc_id=$1 [R]
RewriteRule ^buy$ /buy.php [R]
RewriteRule ^sell$ /sell.php [R]
RewriteRule ^feedback$ /feedback.php [R]
RewriteRule ^aboutus$ /about.php [R,L]

 

I have checked with my host and mod_rewrite is installed on the server and properly configured.  So, that is not the problem.

 

Any ideas on what the heck I am doing wrong?

 

Thanks!

 

 

Link to comment
https://forums.phpfreaks.com/topic/206021-rewrite-not-working/
Share on other sites

You tell us, what IS the problem? Assumably something isn't working how you expect, but since you haven't stated what we can't help you. The code you have posted will redirect http://domain/buy-wow-account/account/20/ to http://domain/character.php?acc_id=20, etc.

Link to comment
https://forums.phpfreaks.com/topic/206021-rewrite-not-working/#findComment-1078070
Share on other sites

Hey there again Cags.

 

The rewrite is not happening whatsoever.  So, I have something wrong with my rules.

 

 

My understanding is that you have it backwards.  I am trying to get it to recognize http://domain/character.php?acc_id=20 and rewrite it to http://domain/buy-wow-account/account/20/.

Link to comment
https://forums.phpfreaks.com/topic/206021-rewrite-not-working/#findComment-1078316
Share on other sites

That's because it's you that has it backwards. A RewriteRule is simply an Alias, that allows you to use the pattern matched in the first half as a valid link to the second.

 

^buy/$ /buy.php [L]

 

Will take requests for http://domain/buy/ and serve up http://domain/buy.php. To test this rule you would have to enter http://domain/buy/ in the address bar, or have a link that has a href of http://domain/buy/

Link to comment
https://forums.phpfreaks.com/topic/206021-rewrite-not-working/#findComment-1078330
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.