WebWiz Forum Example

Helicon Ape provides support for Apache .htacces and .htpasswd configuration files for Microsoft IIS.
User avatar
Posts: 10
Joined: 17 Jun 2012, 07:25

WebWiz Forum Example

22 Jun 2012, 09:05

Hello,

I am having a few problems getting the webwizguide example to work, I have installed the latest version of webwiz formums and followed the example on this page:

http://www.helicontech.com/articles/mod_seo/

I am getting 404 errors when I click on the seo friendly urls

Is it because the seorule is not creating the new link correctly?

This is the rule in the example
SeoRule forum_posts.asp\?TID=(\d+)(?:\&PN=(\d+)\&TPN=(\d+))?(?:&(get=last#\d+))?$ $1-${slug:${SeoTopic:$1|not-found}}(?2-$3).html?4\?$4 [Redirect,Scope=A]

And this is the link from the forum
http://www.cpdevsite.net/forum/forum_po ... -subject#1


Thanks,

Andrew

User avatar
Posts: 402
Joined: 06 Mar 2012, 11:59

Re: WebWiz Forum Example

22 Jun 2012, 10:23

Please try the following .htaccess instead:


Code: Select all
DBDriver mssql
# include DBDParams
DBDParams "Data Source=(local)\SQLEXPRESS;Initial Catalog=WebWizForum;User ID=sa;Password=*****"
DBDPrepareSQL "SELECT [Subject]     FROM [WebWizForum].[dbo].[tblTopic]  WHERE [Topic_ID] =@KEY"               getSeoTopic
DBDPrepareSQL "SELECT [Forum_name]  FROM [WebWizForum].[dbo].[tblForum]  WHERE [Forum_ID] =@KEY"               getSeoForum

RewriteMap SeoTopic dbd:getSeoTopic
RewriteMap SeoForum dbd:getSeoForum
RewriteMap slug int:slug

#SEO-ing
SeoRule forum_topics\.asp\?FID=(\d+)\&title=([^\s"'$&]*)         forum$1-$2.html [Redirect,Scope=A]
SeoRule forum_topics.asp\?FID=(\d+)&PN=(\d+)$         forum$1-${slug:${SeoForum:$1|not-found}}-$2.html [Redirect,Scope=A]
SeoRule forum_topics.asp\?FID=(\d+)$         forum$1-${slug:${SeoForum:$1|not-found}}.html [Redirect,Scope=A]

SeoRule forum_posts.asp\?TID=(\d+)\&title=([^\s"'$&]*)(?:&(get=last#\d+))?         $1-$2.html?4\?$4 [Redirect,Scope=A]
SeoRule forum_posts.asp\?TID=(\d+)(?:\&PN=(\d+)\&TPN=(\d+))?(?:&(get=last#\d+))?$         $1-${slug:${SeoTopic:$1|not-found}}(?2-$3).html?4\?$4 [Redirect,Scope=A]



#rewrite to the original ones
RewriteRule ^forum/forum(\d+)-.*(?:-(\d+))\.html$ /forum/forum_topics.asp\?FID=$1&PN=$2 [NC,QSA,L]
RewriteRule ^forum/forum(\d+)-.*\.html$ /forum/forum_topics.asp\?FID=$1 [NC,QSA,L]

RewriteRule ^forum/(\d+)-.*(?:-(\d+))\.html$ /forum/forum_posts.asp\?TID=$1&TPN=$2 [NC,QSA]
RewriteRule ^forum/(\d+)-.*\.html$ /forum/forum_posts.asp\?TID=$1 [NC,QSA]


User avatar
Posts: 402
Joined: 06 Mar 2012, 11:59

Re: WebWiz Forum Example

22 Jun 2012, 10:29

BTW, consider using free and open source phpBB with URLs like in the community forum we are currently using. Here is a guide: http://www.helicontech.com/articles/sea ... for-phpbb/

User avatar
Posts: 10
Joined: 17 Jun 2012, 07:25

Re: WebWiz Forum Example

22 Jun 2012, 10:43

Hello,

Thanks for your reply.

I have replaced the code in .htaccess with the one you supplied and when I click the link it produces the link in the example like "forum1-my-topic.html" however I am getting a 404 error, any ideas what it can be?

Andrew

User avatar
Posts: 10
Joined: 17 Jun 2012, 07:25

Re: WebWiz Forum Example

22 Jun 2012, 10:46

ok I have solved that.

#rewrite to the original ones
RewriteRule ^forum/forum(\d+)-.*(?:-(\d+))\.html$ /forum/forum_topics.asp\?FID=$1&PN=$2 [NC,QSA,L]
RewriteRule ^forum/forum(\d+)-.*\.html$ /forum/forum_topics.asp\?FID=$1 [NC,QSA,L]

RewriteRule ^forum/(\d+)-.*(?:-(\d+))\.html$ /forum/forum_posts.asp\?TID=$1&TPN=$2 [NC,QSA]
RewriteRule ^forum/(\d+)-.*\.html$ /forum/forum_posts.asp\?TID=$1 [NC,QSA]

I just removed the "forum/" the the beginning in each line and it worked ok

User avatar
Posts: 10
Joined: 17 Jun 2012, 07:25

Re: WebWiz Forum Example

22 Jun 2012, 10:49

Hello Again,

Still trying to learn this stuff, have you got a link to docs where i can understand what all this is/does?

=(\d+)\&title=([^\s"'$&]*)(?:&(get=last#\d+))?

Thanks,

Andrew

User avatar
Posts: 402
Joined: 06 Mar 2012, 11:59

Re: WebWiz Forum Example

22 Jun 2012, 11:05

OK, I guess this is because your .htaccess is already in the /forum/ directory, while original rules were designed to be in the root.

Well... it's regular expression and format string syntax. It may seem to be harder to read than actually to write it :)
Documentation links:


User avatar
Posts: 10
Joined: 17 Jun 2012, 07:25

Re: WebWiz Forum Example

22 Jun 2012, 12:24

Thankyou for your help so far, I am slowly getting there with this.

I have another question:

Is it possible to have a rewriterule to pull the existing link and pull the id from the database mapfile.

for example.


cpdevsite.net/aqua/products/caribe-piranha-15-2-pygocentrus-notatus.html

and point it to

cpdevsite.net/aqua/prodview.asp?idProduct=1 (say 1 is the record with the FriendlyURL = 'caribe-piranha-15-2-pygocentrus-notatus')

I have tried this and could not get it work.

Code: Select all
# Helicon Ape version 3.0.0.76

RewriteEngine on

DBDriver mssql

# include DBDParams
DBDParams "Data Source=xxxxx;Initial Catalog=my-database-name;User ID=my-username;Password=-my-password"
DBDPrepareSQL "SELECT [idproduct] FROM [my-database-name].[dbo].[products] WHERE [FriendlyUrl] =@KEY" getProductId

RewriteMap SEOProdID dbd:getProductId



RewriteRule ^/aqua/products/(\d+)-.*\.html$ /prodview.asp?idproduct=${SeoProductId:$1|not-found}

User avatar
Posts: 402
Joined: 06 Mar 2012, 11:59

Re: WebWiz Forum Example

22 Jun 2012, 14:37

This is possible in theory. The problem is that thread topic does not necessarily identify unique forum topic in the database. So I suggest you to stay with current solution - having unique topic identifire along with the SEO representation. Few additional numbers will not affect SEO ranking.

Return to Helicon Ape

Who is online

Users browsing this forum: No registered users and 19 guests