Jump to content

[SOLVED] Help with Rule


Warriorpt

Recommended Posts

Hi everyone,

 

i have in my htacess this:

 

#Rewrite Rules

RewriteRule ^match/([0-9]+)$ ?k=match&id=$1

RewriteRule ^([a-zA-Z0-9]+)/$ ?k=about

RewriteRule ^([a-zA-Z0-9]+)$ ?k=about

RewriteRule ^([a-zA-Z0-9]+)/$ ?k=matches

RewriteRule ^([a-zA-Z0-9]+)$ ?k=matches

 

but, in my website, when i try to call /matches/ the website open the /about/ page.

 

If i change to:

 

#Rewrite Rules

RewriteRule ^match/([0-9]+)$ ?k=match&id=$1

RewriteRule ^([a-zA-Z0-9]+)/$ ?k=matches

RewriteRule ^([a-zA-Z0-9]+)$ ?k=matches

RewriteRule ^([a-zA-Z0-9]+)/$ ?k=about

RewriteRule ^([a-zA-Z0-9]+)$ ?k=about

 

The /matches/ page open, but when i click in /about/, it opens the matches page.

There are some way to repair that?

Link to comment
Share on other sites

Hi there

 

In your first example, if you access "/matches/" the second rule is redirecting you to your about page. This is because ^([a-zA-Z0-9]+)/$ is trying to find any combination of letters and numbers and a slash, which includes the string "/matches/". If you want something else to happen when you access "/matches/", create rules like this:

 

RewriteRule ^matches/?$ ?k=matches

RewriteRule ^about/?$ ?k=about

 

The question mark is useful before the slash as it means with or without the preceding character. Hope this helps.

 

Jamie

Link to comment
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.