This forum has been moved here:
Helicon Tech Community Forum

Helicon Ape (Forum Locked Forum Locked)
 Helicon Tech : Helicon Ape
Subject Topic: Helicon APE rewritting URLs syntax
Author
Message |
GarethTnash
Groupie


Joined: 28 April 2010
Location: United Kingdom
Posts: 43
Posted: 06 August 2010 at 5:44am

Hello,

I have Helicon Ape running on some of my sites however on the original sites the links are relative to the document and not the root.

as a result my links look like this -

http://www.hampshirejobsonline.co.uk/search~jobs-in~~keywords~~RegID~Hampshire~sector~Accountancy~SID~871.htm

I have a new project that I am working on, which can be seen below. This project uses links relative to the site root.

http://nfd.netsolva.co.uk/default.asp

I would like the links to be rewritten like this if possible

http://nfd.netsolva.co.uk/flowers/ID-C2/Beautiful-Flowers-For-Birthdays-delivered-by-Bortsmouth-Florist

or worst case scenario like -

http://nfd.netsolva.co.uk/flowers/ID-C2/Beautiful-Flowers-For-Birthdays-delivered-by-Bortsmouth-Florist.htm

currently they look like -

http://nfd.netsolva.co.uk/flowers.asp?ID=C2&Beautiful-Flowers-For-Birthdays-delivered-by-Bortsmouth-Florist

grateful if you could advise how to write the syntax for this please.

Many thanks

 

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 06 August 2010 at 5:58am

Please try to use the following code:

RewriteEngine on
RewriteBase /
RewriteCond %{QUERY_STRING} ^ID=([^&]+)&(.+)$ [NC]
RewriteRule ^flowers\.asp$ flowers/ID-%1/%2? [NC,R=301,L]
RewriteRule flowers/ID-([^/]+)/(.+)$ flowers.asp?ID=$1&$2 [NC,L]

__________________
Regards,
Anton
Back to Top
 
GarethTnash
Groupie


Joined: 28 April 2010
Location: United Kingdom
Posts: 43
Posted: 06 August 2010 at 6:36am

Thanks Anton,

Quick question, I want to rewite for all pages not just the flowers.asp one exception to that though is that I have an amin directory where I dont want any of the URLs to be rewritten.

Thanks for your help in advance

GTN

P.S - Hope you are well?

Back to Top
 
GarethTnash
Groupie


Joined: 28 April 2010
Location: United Kingdom
Posts: 43
Posted: 06 August 2010 at 7:05am

Also - sorry the current syntax reads like so -

"

# Helicon Ape version 3.0.0.40

SetEnvIfNoCase request_uri ^/(?!em/|js/|wm/).*$ mod_linkfreeze

#LinkFreezeRule ~~~ asp=htm ^(?!/?search\.asp).*$ [ MoveExt ]

LinkFreezeRule ~~~ asp=htm [ MoveExt ]

 

 

# Fixing search by mod_rewrite

#RewriteEngine on

#RewriteRule ^search\.htm$ /search.asp [NC,L]"

Please could you show me what to change

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 09 August 2010 at 2:06am

Here's the config to rewrite all asp requests. Is it ok, or you have other patterns to be rewritten? If yes, please give examples for them.

RewriteEngine on
RewriteBase /
RewriteCond %{QUERY_STRING} ^ID=([^&]+)&(.+)$ [NC]
RewriteRule ^([^/.]+)\.asp$ $1/ID-%1/%2? [NC,R=301,L]
RewriteRule ([^/.]+)/ID-([^/]+)/(.+)$ $1.asp?ID=$1&$2 [NC,L]

__________________
Regards,
Anton
Back to Top
 
GarethTnash
Groupie


Joined: 28 April 2010
Location: United Kingdom
Posts: 43
Posted: 09 August 2010 at 4:01am

Sorry Anton, that isn't working - it just redirects everything to -

http://nfd.netsolva.co.uk/flowers/ID-flowers/flowers and we get the 404 error

What I am trying to achieve(for all web pages except any in the directory amin) is -

? becomes /

& becomes /

= becomes -

.asp is removed

So as an example

http://nfd.netsolva.co.uk/flowers.asp?ID=C2&Beautiful-Flowers-For-Birthdays-delivered-by-Bortsmouth-Florist

becomes -

http://nfd.netsolva.co.uk/flowers/ID-C2/Beautiful-Flowers-For-Birthdays-delivered-by-Bortsmouth-Florist

the area that has changed being -

.asp?ID=C2&

to

/ID-C2/

Hope that makes sense?

I guess I still need to include a line like -

SetEnvIfNoCase request_uri ^/(?!amin/).*$ mod_linkfreeze

to stop APE from rewritting web pages within the amin directory

Appreciate any help you can offer -

Many thanks

 

 

Back to Top
 
GarethTnash
Groupie


Joined: 28 April 2010
Location: United Kingdom
Posts: 43
Posted: 09 August 2010 at 4:51am

Hello,

If I try using this -

"# Helicon Ape version 3.0.0.40

SetEnvIfNoCase request_uri ^/(?!amin/).*$ mod_linkfreeze
#LinkFreezeRule ~~~ asp=htm ^(?!/?search\.asp).*$ [ MoveExt ]
LinkFreezeRule //- asp=htm [ MoveExt ]

 

# Fixing search by mod_rewrite
#RewriteEngine on
#RewriteRule ^search\.htm$ /search.asp [NC,L]"

When I click on the following URL -

http://nfd.netsolva.co.uk/flowers.asp?ID=C1&Beautiful-Flowers-For-Anniversairies-delivered-by-Bortsmouthflorist

 it redirects me to

http://nfd.netsolva.co.uk/flowers/Beautiful-Flowers-For-Anniversairies-delivered-by-Bortsmouth-florist/ID-C1.htm

However there I get a 404 error which reads -

Requested URL http://nfd.netsolva.co.uk:80/flowers/Beautiful-Flowers-For-Anniversairies-delivered-by-Bortsmouth-florist/.asp?C1=&flowers=Beautiful&Flowers-For-Anniversairies-delivered-by-Bortsmouth-florist=ID
Physical Path D:\vhosts\netsolva.co.uk\subdomains\nfd\httpdocs\flowers\Beautiful-Flowers-For-Anniversairies-delivered-by-Bortsmouth-florist\.asp
Logon Method Anonymous
Logon User Anonymous

So it looks to me as the physical path is incorrect.

 

Please help, I'm on a timeline with this project, and get SEO friendly URLs is priority number 1!!

Thanks Anton

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 09 August 2010 at 7:09am

Sorry for my misunderstanding...
I guess you were trying to apply mod_linkfreeze to resolve you task and I offered you a mod_rewrite solution.
Let's try to fix your mod_linkfreeze config:

SetEnvIfNoCase request_uri ^/(?!amin/).*$ mod_linkfreeze
LinkFreezeRule ~~~ asp=htm [ MoveExt ]

But this will give you http://nfd.netsolva.co.uk/flowers~ID~C2~Beautiful-Flowers-For-Birthdays-delivered-by-Bortsmouth-Florist.htm
Is it ok? Please try it.

__________________
Regards,
Anton
Back to Top
 
GarethTnash
Groupie


Joined: 28 April 2010
Location: United Kingdom
Posts: 43
Posted: 09 August 2010 at 8:07am

Thanks Anton, is there anyway of getting -

LinkFreezeRule //- asp=htm [ MoveExt ]

instead of -

LinkFreezeRule ~~~ asp=htm [ MoveExt ]

 

Thanks

Back to Top
 
GarethTnash
Groupie


Joined: 28 April 2010
Location: United Kingdom
Posts: 43
Posted: 09 August 2010 at 8:26am

I've been tasked with making the URL appear as neat as possible so like

domainname/page/parameter1-value/parameter2-value

instead of

domainname~page~parameter1~value~parameter2~value.htm

Please advise - my client is not very happy with me

thank you

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 09 August 2010 at 8:33am

You see, you can't use "-" as a replacement character a it is used in your URLs and mod_linkfreeze can't distinguish them.

Slashes "/" in its turn may cause your css/js/images to break because it will look like you've changed you folders structure and some
relative links may break.

So, theoretically it's possible to have any kind of replacement characters, but some may interfere with the chars in your URLs and some are
more safe, like ~ for example.

__________________
Regards,
Anton
Back to Top
 
GTN1707
Newbie


Joined: 20 January 2010
Location: United Kingdom
Posts: 6
Posted: 09 August 2010 at 8:38am

I've re written the URLs for CSS/JS?images etc so that they arre all root specific -"/styles/style1.css" as opposed to "styles/style1.css"

So that it can work with slashes, but it is failing, client really wants it to look like -

domainname/page/parameter1-value/parameter2-value

I can potentially remove the "-"s in the URLs if needbe, but would need to replace " " with something, perhaps "+"?

I can re write the url parameters sent, once I know how to achieve the base that the client is asking for..

Please advise - thank you

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 09 August 2010 at 8:51am

Ok, then (if you remove the -s from the URLs) you can try this config:

LinkFreezeRule //- asp=htm [ MoveExt ]

__________________
Regards,
Anton
Back to Top
 
GarethTnash
Groupie


Joined: 28 April 2010
Location: United Kingdom
Posts: 43
Posted: 09 August 2010 at 9:58am

Sorry still getting a 404 error -

Requested URL http://nfd.netsolva.co.uk:80/flowers/.asp?C1=&flowers=ID
Physical Path

D:\vhosts\netsolva.co.uk\subdomains\nfd\httpdocs\flowers\.asp

 

 

 

click on Anniversairy in the "By Event" nav lefthand column---

takes you too http://nfd.netsolva.co.uk/flowers/ID-C1.htm where you get the 404 error?

 

Back to Top
 
GarethTnash
Groupie


Joined: 28 April 2010
Location: United Kingdom
Posts: 43
Posted: 09 August 2010 at 10:36am

Another quick question, why is the first parameter moved to the last position once rewritten?

If I move the most important name value pair to the last part of the query string, the following works "

LinkFreezeRule --- asp=htm [ MoveExt ]"

as the following URL works fine -

http://nfd.netsolva.co.uk/flowers-Beautiful-Flowers-For-Anniversairies-delivered-by-Bortsmouth-florist-ID-C1.htm

 

but the one below seems to fail because of the '--' before ID 

http://nfd.netsolva.co.uk/flowers-Beautiful-Flowers-For-Birthdays-delivered-by-Bortsmouth-Florist--ID-C2.htm

Back to Top
 
GarethTnash
Groupie


Joined: 28 April 2010
Location: United Kingdom
Posts: 43
Posted: 10 August 2010 at 3:34am

Good morning,

I still can't get this to work.

for instance if I have a web page called 'contact-us.asp' with a querystring of '?Bortsmouth=Florist' following it, the page should go to

http://nfd.netsolva.co.uk/Contact-us-Bortsmouth-Florist.htm

where I get a 404 error message.

I really need to get this resolved today using slashes '/' and hypens '-' not by using ~

Please advise whether this can be done using APE, or whether i need to look for an alternative ISAPI rewriter.

thank you

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 10 August 2010 at 3:45am

We've found another solution to your issue with the help of which you'll be able to meet your client's reuqirements.
What you need is update to the latest build of Helicon Ape.
Then check in httpd.conf that mod_seo module (brand new module we'll make use of) is enabled.

Then comment out the LinkFreezeRule and put the following config into your .htaccess:

RewriteEngine on
RewriteBase /
SeoRule ^([^/.]+)\.asp\?ID=([^&]+)&(.+)$ $1/ID-$2/$3? [NC,L]
RewriteRule ([^/.]+)/ID-([^/]+)/(.+)$ $1.asp?ID=$1&$2 [NC,L]

This should work for root-relative links. If you have absolute links, I'll fix the config for you.

__________________
Regards,
Anton
Back to Top
 
GarethTnash
Groupie


Joined: 28 April 2010
Location: United Kingdom
Posts: 43
Posted: 10 August 2010 at 3:51am

thanks Anton, that is great,

how do I "update to the latest build of Helicon Ape"?

will it effect the other sites that are currently running APE?

Is there any chance you can show me what needs to be done, if i give you remote server access?

thank you 

Back to Top
 
GarethTnash
Groupie


Joined: 28 April 2010
Location: United Kingdom
Posts: 43
Posted: 10 August 2010 at 5:25am

Hi Anton,

Have been trying to figure this out myself, but I'm confused -

I have the Server license.

From within APE Manager, i have selected Help > Check for updates, which takes me to -http://www.helicontech.com/download-ape.htm

the only two options that I see are the 45 day free trial and the freeware (for three sites) - which should I select?

Do I need to uninstall APE first?

Will installing the updated version overwrite all the existing sites (76) ISAPI rules?

Please advise - thank you

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 10 August 2010 at 9:10am

I'll explain:

1. you don't need to uninstall old version.
2. download the one with 45-day trial (not Free).
3. Run it. It will update automatically and all the existing configs will remain intact.

__________________
Regards,
Anton
Back to Top
 

Page of 2 Next >>
 
Printable version Printable version