Jump to content

SEO - .htaccess RewriteRule for KB


Nullified

Recommended Posts

Default:

# Knowledgebase
RewriteRule ^knowledgebase/([0-9]+)/[a-z0-9_-]+/[a-z0-9_-]+\.php$ ./knowledgebase.php?action=displayarticle&id=$1 [L,NC]
RewriteRule ^knowledgebase/([0-9]+)/([^/]*)$ ./knowledgebase.html?action=displaycat&catid=$1 [L,NC]
RewriteRule ^knowledgebase$ ./knowledgebase.php [L,NC]

 

I have written a custom script that acquires the article's category name and I would like to substitute that for the category id in the url.

Current KB link structure:

http://my.domain.com/knowledgebase/3/Shared-Web-Hosting/Dreamweaver-Site-Settings.php?article=3

 

I want to remove the 3 from the director structure, however to do so I must change the rewrite rule. I have tried like this:

RewriteRule ^knowledgebase/[a-z0-9_-]+/[a-z0-9_-]+\.php?article=+([0-9]+)$ ./knowledgebase.php?action=displayarticle&id=$4 [L,NC]

 

However, this does not work. Please advise.

Edited by Nullified
Link to comment
Share on other sites

  • 1 year later...
Task Complete with a Rewrite Condition:

RewriteCond %{QUERY_STRING} (?:^|&)article=(\d+)(?:&|$)

RewriteRule ^knowledgebase/[a-z0-9_-]+/[a-z0-9_-]+\.php ./knowledgebase.php?action=displayarticle&id=%1 [L,NC]

 

Could you publish the .htaccess, somehow i could not fix that issue with the category and the number...

Link to comment
Share on other sites

I did, it's in my above post.

 

I was searching for that long time. ;-)

Did you found a solution?

 

With the .htaccess it did not work. :(

 

 

Any help would help. :)

 

Thanks a lot

 

- - - Updated - - -

 

I used the same Line, but i get a error.

 

Did you found the solution?

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated