This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: Very short URL�s for SEO
Author
Message |
simbiot
Newbie


Joined: 09 May 2011
Posts: 6
Posted: 06 November 2011 at 5:43pm

Hi there!

I'm trying to make my url's shorter and I'm wondering if someone could help me out a bit.

Current situation:
Right now my url's are very long: www.domain.com/site/article/12333/My-title-goes-here
RewriteRule ^site/article/(.*)/(.*) site/Article.aspx?id=$1  

Desired situation:
I'm trying to make the following url's work: www.domain.com/My-title-goes-here, but the result is that my CSS and images can't be displayed.
RewriteRule ^(.*) site/Article.aspx?id=$1

Note:
This rule is also conflicting with my sitemap.xml reference: www.domain.com/sitemap.xml
RewriteRule ^sitemap.xml site/Sitemap.aspx

Any advice on how I can make this work out?

Thanks!

Edited by simbiot - 07 November 2011 at 4:14am
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 08 November 2011 at 4:33am

Hello,

The images and .css files will not be affected in case you have root-relative or absolute paths in your page code.
Put your sitemap rule on top of the config files and it must do the trick.

Regards
Andrew
Back to Top
 
simbiot
Newbie


Joined: 09 May 2011
Posts: 6
Posted: 08 November 2011 at 3:44pm

Thanks Andrew!

Unfortunately, placing my new "RewriteRule ^(.*) site/Article.aspx?id=$1" rule at the bottom of my .Htaccess file doesn't do the trick. And my css files and images are already referenced with the full path.

Am I referencing "http://www.domain.com" by doing this "^(.*)"?

Cheers
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 11 November 2011 at 5:40am

Please, provide your config file as it is and your rewrite.log for the testing request.
Logging issues described in FAQ

Regards
Andrew
Back to Top
 
simbiot
Newbie


Joined: 09 May 2011
Posts: 6
Posted: 15 November 2011 at 9:40pm

Hi Andrew,

It took me a while, but I've managed to get the rewrite.log to work. You can find the info below.

It seems as if all links get pointed to Default.aspx with the actual redirect url as parameter.

Looking forward hearing from you.

Cheers!
Gavin

My .htaccess file:
Code:
# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.63

RewriteEngine on
# RewriteBase /

# Permalinks
RewriteRule ^facebook http\://www.facebook.com/cocacola
RewriteRule ^twitter http\://www.twitter.com/cocacola
RewriteRule ^blog http\://www.livepositively.com/
RewriteRule ^sitemap.xml _scripts/Sitemap.aspx

# Admin section
RewriteRule ^admin/logout admin/Logout.aspx   
RewriteRule ^admin/dashboard admin/Dashboard.aspx   

# Current long url's
RewriteRule ^site/article/(.*)/(.*) site/Default.aspx?id=$1  
# www.domain.com/site/article/1234567/keywords-go-here

# Desired short url's
RewriteRule ^(.*) site/Default.aspx?id=$1   
# www.domain.com/keywords-go-here


My Rewrite.log file:
Code:
ÿþ127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:02 GMT [localhost/sid#1][rid#10982612/initial] (2) init rewrite engine with requested uri /Spaceships/keywords-go-here
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:02 GMT [localhost/sid#1][rid#10982612/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:02 GMT [localhost/sid#1][rid#10982612/initial] (1) Htaccess process request c:\inetpub\wwwroot\spaceships\.htaccess
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:02 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^facebook' to uri 'keywords-go-here'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:02 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^twitter' to uri 'keywords-go-here'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:02 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^blog' to uri 'keywords-go-here'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:02 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^sitemap.xml' to uri 'keywords-go-here'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:02 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^admin/logout' to uri 'keywords-go-here'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:02 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^admin/dashboard' to uri 'keywords-go-here'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:02 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^site/article/(.*)/(.*)' to uri 'keywords-go-here'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:02 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^(.*)' to uri 'keywords-go-here'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:02 GMT [localhost/sid#1][rid#10982612/initial] (1) Rewrite URL to >> /Spaceships/site/Default.aspx?id=keywords-go-here
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:02 GMT [localhost/sid#1][rid#10982612/initial] (2) rewrite 'keywords-go-here' -> '/Spaceships/site/Default.aspx?id=keywords-go-here'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:02 GMT [localhost/sid#1][rid#10982612/initial] (2) internal redirect with /Spaceships/site/Default.aspx?id=keywords-go-here [INTERNAL REDIRECT]

127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:32 GMT [localhost/sid#1][rid#10982612/initial] (2) init rewrite engine with requested uri /Spaceships/facebook
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:32 GMT [localhost/sid#1][rid#10982612/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:32 GMT [localhost/sid#1][rid#10982612/initial] (1) Htaccess process request c:\inetpub\wwwroot\spaceships\.htaccess
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:32 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^facebook' to uri 'facebook'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:32 GMT [localhost/sid#1][rid#10982612/initial] (2) explicitly forcing redirect with http://www.facebook.com/cocacola
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:32 GMT [localhost/sid#1][rid#10982612/initial] (2) rewrite 'facebook' -> 'http://www.facebook.com/cocacola'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:32 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^twitter' to uri 'facebook'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:32 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^blog' to uri 'facebook'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:32 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^sitemap.xml' to uri 'facebook'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:32 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^admin/logout' to uri 'facebook'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:32 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^admin/dashboard' to uri 'facebook'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:32 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^site/article/(.*)/(.*)' to uri 'facebook'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:32 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^(.*)' to uri 'facebook'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:32 GMT [localhost/sid#1][rid#10982612/initial] (1) Rewrite URL to >> /Spaceships/site/Default.aspx?id=facebook
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:32 GMT [localhost/sid#1][rid#10982612/initial] (2) rewrite 'facebook' -> '/Spaceships/site/Default.aspx?id=facebook'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:32 GMT [localhost/sid#1][rid#10982612/initial] (2) internal redirect with /Spaceships/site/Default.aspx?id=facebook [INTERNAL REDIRECT]

127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:54 GMT [localhost/sid#1][rid#10982612/initial] (2) init rewrite engine with requested uri /Spaceships/twitter
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:54 GMT [localhost/sid#1][rid#10982612/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:54 GMT [localhost/sid#1][rid#10982612/initial] (1) Htaccess process request c:\inetpub\wwwroot\spaceships\.htaccess
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:54 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^facebook' to uri 'twitter'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:54 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^twitter' to uri 'twitter'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:54 GMT [localhost/sid#1][rid#10982612/initial] (2) explicitly forcing redirect with http://www.twitter.com/cocacola
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:54 GMT [localhost/sid#1][rid#10982612/initial] (2) rewrite 'twitter' -> 'http://www.twitter.com/cocacola'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:54 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^blog' to uri 'twitter'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:54 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^sitemap.xml' to uri 'twitter'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:54 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^admin/logout' to uri 'twitter'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:54 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^admin/dashboard' to uri 'twitter'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:54 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^site/article/(.*)/(.*)' to uri 'twitter'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:54 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^(.*)' to uri 'twitter'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:54 GMT [localhost/sid#1][rid#10982612/initial] (1) Rewrite URL to >> /Spaceships/site/Default.aspx?id=twitter
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:54 GMT [localhost/sid#1][rid#10982612/initial] (2) rewrite 'twitter' -> '/Spaceships/site/Default.aspx?id=twitter'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:32:54 GMT [localhost/sid#1][rid#10982612/initial] (2) internal redirect with /Spaceships/site/Default.aspx?id=twitter [INTERNAL REDIRECT]

127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:03 GMT [localhost/sid#1][rid#10982612/initial] (2) init rewrite engine with requested uri /Spaceships/sitemap.xml
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:03 GMT [localhost/sid#1][rid#10982612/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:03 GMT [localhost/sid#1][rid#10982612/initial] (1) Htaccess process request c:\inetpub\wwwroot\spaceships\.htaccess
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:03 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^facebook' to uri 'sitemap.xml'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:03 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^twitter' to uri 'sitemap.xml'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:03 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^blog' to uri 'sitemap.xml'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:03 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^sitemap.xml' to uri 'sitemap.xml'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:03 GMT [localhost/sid#1][rid#10982612/initial] (1) Rewrite URL to >> /Spaceships/_scripts/Sitemap.aspx
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:03 GMT [localhost/sid#1][rid#10982612/initial] (2) rewrite 'sitemap.xml' -> '/Spaceships/_scripts/Sitemap.aspx'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:03 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^admin/logout' to uri '_scripts/Sitemap.aspx'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:03 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^admin/dashboard' to uri '_scripts/Sitemap.aspx'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:03 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^site/article/(.*)/(.*)' to uri '_scripts/Sitemap.aspx'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:03 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^(.*)' to uri '_scripts/Sitemap.aspx'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:03 GMT [localhost/sid#1][rid#10982612/initial] (1) Rewrite URL to >> /Spaceships/site/Default.aspx?id=_scripts/Sitemap.aspx
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:03 GMT [localhost/sid#1][rid#10982612/initial] (2) rewrite '_scripts/Sitemap.aspx' -> '/Spaceships/site/Default.aspx?id=_scripts/Sitemap.aspx'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:03 GMT [localhost/sid#1][rid#10982612/initial] (2) internal redirect with /Spaceships/site/Default.aspx?id=_scripts/Sitemap.aspx [INTERNAL REDIRECT]

127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:21 GMT [localhost/sid#1][rid#10982612/initial] (2) init rewrite engine with requested uri /Spaceships/admin/dashboard
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:21 GMT [localhost/sid#1][rid#10982612/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:21 GMT [localhost/sid#1][rid#10982612/initial] (1) Htaccess process request c:\inetpub\wwwroot\spaceships\.htaccess
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:21 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^facebook' to uri 'admin/dashboard'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:21 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^twitter' to uri 'admin/dashboard'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:21 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^blog' to uri 'admin/dashboard'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:21 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^sitemap.xml' to uri 'admin/dashboard'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:21 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^admin/logout' to uri 'admin/dashboard'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:21 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^admin/dashboard' to uri 'admin/dashboard'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:21 GMT [localhost/sid#1][rid#10982612/initial] (1) Rewrite URL to >> /Spaceships/admin/Dashboard.aspx
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:21 GMT [localhost/sid#1][rid#10982612/initial] (2) rewrite 'admin/dashboard' -> '/Spaceships/admin/Dashboard.aspx'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:21 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^site/article/(.*)/(.*)' to uri 'admin/Dashboard.aspx'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:21 GMT [localhost/sid#1][rid#10982612/initial] (3) applying pattern '^(.*)' to uri 'admin/Dashboard.aspx'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:21 GMT [localhost/sid#1][rid#10982612/initial] (1) Rewrite URL to >> /Spaceships/site/Default.aspx?id=admin/Dashboard.aspx
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:21 GMT [localhost/sid#1][rid#10982612/initial] (2) rewrite 'admin/Dashboard.aspx' -> '/Spaceships/site/Default.aspx?id=admin/Dashboard.aspx'
127.0.0.1 127.0.0.1  Wed, 16-Nov-2011  04:33:21 GMT [localhost/sid#1][rid#10982612/initial] (2) internal redirect with /Spaceships/site/Default.aspx?id=admin/Dashboard.aspx [INTERNAL REDIRECT]

Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 16 November 2011 at 6:00am

Hello Gavin,

Here's an extract from the log for the first request:

(2) init rewrite engine with requested uri /Spaceships/keywords-go-here
(3) applying pattern '^(.*)' to uri 'keywords-go-here'
(1) Rewrite URL to >> /Spaceships/site/Default.aspx?id=keywords-go-here
(2) rewrite 'keywords-go-here' -> '/Spaceships/site/Default.aspx?id=keywords-go-here'
(2) internal redirect with /Spaceships/site/Default.aspx?id=keywords-go-here [INTERNAL REDIRECT]

I just can't get this /Spaceships/ thing. It is everywhere, in each request. In case we will really use it, than we need to include this in the patterns. Or
did I get you wring?


Regards
Andrew
Back to Top
 
simbiot
Newbie


Joined: 09 May 2011
Posts: 6
Posted: 16 November 2011 at 10:40pm

Hi Andrew,

The /Spaceships/ thing is just a reference to my localhost project. All requests are redirected to: http://localhost/Spaceships/.

The IP address is also 127.0.0.1, 'cause I'm testing all this locally before I push any changes live.

Hope this helps.

Cheers
Gavin
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 17 November 2011 at 7:34am

That's a pretty thing to say! )))
You need to apply the following

Code:
Desired short url's
RewriteRule ^Spaceships/([^/]+) /site/Default.aspx?id=$1    
# www.domain.com/spaceships/keywords-go-here


instead of

Code:
Desired short url's
RewriteRule ^(.*) site/Default.aspx?id=$1    
# www.domain.com/keywords-go-here


For request like /Spaceships/keywords-go-here

Regards
Andrew
Back to Top
 
simbiot
Newbie


Joined: 09 May 2011
Posts: 6
Posted: 17 November 2011 at 5:34pm

Hi Andrew,

I've tried out the new rule and it doesn't seem to work for me when I try to check out: http://localhost/Spaceships/keywords-go-here. I get a 404 error message.

The current old rule does seem to work:
# Current long url's
RewriteRule ^site/article/(.*)/(.*) site/Default.aspx?id=$1
http://localhost/Spaceships/site/article/1234/keywords-go-here

So do the following url's:
http://localhost/Spaceships/facebook
http://localhost/Spaceships/twitter
http://localhost/Spaceships/blog
http://localhost/Spaceships/sitemap.xml
http://localhost/Spaceships/admin/logout
http://localhost/Spaceships/admin/dashboard

I'm also wondering how this would eventually work online as the 'Spaceships' reference will no longer be valid -> http://localhost/Spaceships/ on localhost is equivalent to http://www.domain.com/ on my webserver.

Cheers,
Gavin
 
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 18 November 2011 at 5:16am

Gavin, I'm completely lost here.

Would you please, provide the rewrite.log for the testing request (http://localhost/Spaceships/keywords-go-here)
Logging issues described in FAQ
Please, use this rule:
RewriteRule ^Spaceships/([^/]+) /site/Default.aspx?id=$1

Regards
Andrew
Back to Top
 
simbiot
Newbie


Joined: 09 May 2011
Posts: 6
Posted: 19 November 2011 at 11:07pm

Hi Andrew, thanks again! I've added my .htaccess file contents and the feedback in Rewrite.log.

Contents .htaccess:
Code:
# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.63

RewriteEngine on
# RewriteBase /

# Permalinks
RewriteRule ^facebook http\://www.facebook.com/cocacola
RewriteRule ^twitter http\://www.twitter.com/cocacola
RewriteRule ^blog http\://www.livepositively.com/
RewriteRule ^sitemap.xml _scripts/Sitemap.aspx

# Admin section   
RewriteRule ^admin/logout admin/Logout.aspx   
RewriteRule ^admin/dashboard admin/Dashboard.aspx   

# Current long url's
RewriteRule ^site/article/(.*)/(.*) site/Default.aspx?id=$1  
# www.domain.com/site/article/1234567/keywords-go-here

# Desired short url's
RewriteRule ^Spaceships/([^/]+) /site/Default.aspx?id=$1
# www.domain.com/keywords-go-here


Results for http://localhost/Spaceships/keywords-go-here (not working: 404 error)
Code:
ÿþ127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:00:28 GMT [localhost/sid#1][rid#10902476/initial] (2) init rewrite engine with requested uri /Spaceships/keywords-go-here
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:00:28 GMT [localhost/sid#1][rid#10902476/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:00:28 GMT [localhost/sid#1][rid#10902476/initial] (1) Htaccess process request c:\inetpub\wwwroot\spaceships\.htaccess
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:00:28 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^facebook' to uri 'keywords-go-here'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:00:28 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^twitter' to uri 'keywords-go-here'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:00:28 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^blog' to uri 'keywords-go-here'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:00:28 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^sitemap.xml' to uri 'keywords-go-here'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:00:28 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^admin/logout' to uri 'keywords-go-here'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:00:28 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^admin/dashboard' to uri 'keywords-go-here'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:00:28 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^site/article/(.*)/(.*)' to uri 'keywords-go-here'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:00:28 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^Spaceships/([^/]+)' to uri 'keywords-go-here'


Results for http://localhost/Spaceships/site/article/12345/keywords-go-here (working)
Code:
ÿþ127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:06:25 GMT [localhost/sid#1][rid#10902476/initial] (2) init rewrite engine with requested uri /Spaceships/site/article/12345/keywords-go-here
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:06:25 GMT [localhost/sid#1][rid#10902476/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:06:25 GMT [localhost/sid#1][rid#10902476/initial] (1) Htaccess process request c:\inetpub\wwwroot\spaceships\.htaccess
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:06:25 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^facebook' to uri 'site/article/12345/keywords-go-here'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:06:25 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^twitter' to uri 'site/article/12345/keywords-go-here'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:06:25 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^blog' to uri 'site/article/12345/keywords-go-here'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:06:25 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^sitemap.xml' to uri 'site/article/12345/keywords-go-here'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:06:25 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^admin/logout' to uri 'site/article/12345/keywords-go-here'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:06:25 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^admin/dashboard' to uri 'site/article/12345/keywords-go-here'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:06:25 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^site/article/(.*)/(.*)' to uri 'site/article/12345/keywords-go-here'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:06:25 GMT [localhost/sid#1][rid#10902476/initial] (1) Rewrite URL to >> /Spaceships/site/Default.aspx?id=12345
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:06:25 GMT [localhost/sid#1][rid#10902476/initial] (2) rewrite 'site/article/12345/keywords-go-here' -> '/Spaceships/site/Default.aspx?id=12345'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:06:25 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^Spaceships/([^/]+)' to uri 'site/Default.aspx'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:06:25 GMT [localhost/sid#1][rid#10902476/initial] (2) internal redirect with /Spaceships/site/Default.aspx?id=12345 [INTERNAL REDIRECT]


Results for http://localhost/Spaceships/sitemap.xml (working)
Code:
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:01:26 GMT [localhost/sid#1][rid#10902476/initial] (2) init rewrite engine with requested uri /Spaceships/sitemap.xml
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:01:26 GMT [localhost/sid#1][rid#10902476/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:01:26 GMT [localhost/sid#1][rid#10902476/initial] (1) Htaccess process request c:\inetpub\wwwroot\spaceships\.htaccess
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:01:26 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^facebook' to uri 'sitemap.xml'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:01:26 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^twitter' to uri 'sitemap.xml'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:01:26 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^blog' to uri 'sitemap.xml'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:01:26 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^sitemap.xml' to uri 'sitemap.xml'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:01:26 GMT [localhost/sid#1][rid#10902476/initial] (1) Rewrite URL to >> /Spaceships/_scripts/Sitemap.aspx
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:01:26 GMT [localhost/sid#1][rid#10902476/initial] (2) rewrite 'sitemap.xml' -> '/Spaceships/_scripts/Sitemap.aspx'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:01:26 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^admin/logout' to uri '_scripts/Sitemap.aspx'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:01:26 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^admin/dashboard' to uri '_scripts/Sitemap.aspx'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:01:26 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^site/article/(.*)/(.*)' to uri '_scripts/Sitemap.aspx'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:01:26 GMT [localhost/sid#1][rid#10902476/initial] (3) applying pattern '^Spaceships/([^/]+)' to uri '_scripts/Sitemap.aspx'
127.0.0.1 127.0.0.1  Sun, 20-Nov-2011  06:01:26 GMT [localhost/sid#1][rid#10902476/initial] (2) internal redirect with /Spaceships/_scripts/Sitemap.aspx [INTERNAL REDIRECT]


Hope this note finds you well.

Cheers

Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 22 November 2011 at 6:54am

Now I see. I've totally missed the part where .htaccess is located in '/Spaceships/' folder.
So you don't really need Spaceships/ in your rule, as initially was intended.

So I went back to our first rule:
RewriteRule ^(.*) site/Default.aspx?id=$1    
# www.domain.com/keywords-go-here

Quote:
(2) init rewrite engine with requested uri /Spaceships/keywords-go-here
(1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
(1) Htaccess process request c:\inetpub\wwwroot\spaceships\.htaccess
...
(3) applying pattern '^(.*)' to uri 'keywords-go-here'
(1) Rewrite URL to >> /Spaceships/site/Default.aspx?id=keywords-go-here
(2) rewrite 'keywords-go-here' -> '/Spaceships/site/Default.aspx?id=keywords-go-here'
(2) internal redirect with /Spaceships/site/Default.aspx?id=keywords-go-here [INTERNAL REDIRECT]


Which actually looks okay. What error do you get when requesting /Spaceships/keywords-go-here with this rule?

Sorry for being dummy. I didn't get this thing with /Spaceships from the start.

Regards
Andrew
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version