This forum has been moved here:
Helicon Tech Community Forum

Helicon Ape (Forum Locked Forum Locked)
 Helicon Tech : Helicon Ape
Subject Topic: Help with redirect
Author
Message |
paladincomp
Newbie


Joined: 16 June 2006
Location: United States
Posts: 11
Posted: 27 February 2011 at 10:53pm

I have a wordpress site that is working fine. I'm trying
to add another rule to handle shortened URLs for
a custom redirector. Here's what I have so far:

============== .htaccess file =====================
# Helicon Ape version 3.0.0.59

RewriteEngine On
RewriteBase /

# Force full URL
RewriteCond Host: domain\.com
RewriteRule (.*) http\://www\.domain\.com$1 [NC,L]

# URL REDIRECT URL
RewriteRule ^/x/(.*) redirect.php?code=$1 [NC,NS,L]

# Wordpress
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [NC,L]
====================================================

The test request should do this:

http://www.domain.com/x/test -->
http://www.domain.com/redirect.php?test

It looks like the rule is being ignored and throwing a
404 error:

Rewrite URL /x/test to >> /index.php [INTERNAL_REDIRECT]

Any ideas what I need to change?

Thanks in advance!!

Tom Nunamaker

====== LOG FILE ==============================

[rid#14230446/initial] (1) [perdir d:\domain\] init
rewrite engine with /x/test
[rid#14230446/initial] (5) [perdir d:\domain\] strip
matching prefix: /x/test -> x/test
[rid#14230446/initial] (3) [perdir d:\domain\] applying
pattern (.*) to uri x/test
[rid#14230446/initial] (4) [perdir d:\domain\]
RewriteCond: input='Host:' pattern='domain\.com' => not-
matched
[rid#14230446/initial] (5) [perdir d:\domain\] strip
matching prefix: /x/test -> x/test
[rid#14230446/initial] (3) [perdir d:\domain\] applying
pattern ^/x/(.*) to uri x/test
[rid#14230446/initial] (5) [perdir d:\domain\] strip
matching prefix: /x/test -> x/test
[rid#14230446/initial] (3) [perdir d:\domain\] applying
pattern . to uri x/test
[rid#14230446/initial] (4) [perdir d:\domain\]
RewriteCond: input='d:\domain\x\test' pattern='-f' =>
matched
[rid#14230446/initial] (4) [perdir d:\domain\]
RewriteCond: input='d:\domain\x\test' pattern='-d' =>
matched
[rid#14230446/initial] (5) [perdir d:\domain\] add per-
dir prefix: index.php -> /index.php
[rid#14230446/initial] (1) [perdir d:\domain\] Rewrite
URL to >> /index.php [REWRITE]
[rid#14230446/initial] (1) [perdir d:\domain\] Rewrite
URL /x/test to >> /index.php [INTERNAL_REDIRECT]
[rid#47253575/initial/1] (5) [perdir d:\domain\] strip
matching prefix: /index.php -> index.php
[rid#47253575/initial/1] (3) [perdir d:\domain\] applying
pattern (.*) to uri index.php
[rid#47253575/initial/1] (4) [perdir d:\domain\]
RewriteCond: input='Host:' pattern='domain\.com' => not-
matched
[rid#47253575/initial/1] (5) [perdir d:\domain\] strip
matching prefix: /index.php -> index.php
[rid#47253575/initial/1] (3) [perdir d:\domain\] applying
pattern ^/x/(.*) to uri index.php
[rid#47253575/initial/1] (5) [perdir d:\domain\] strip
matching prefix: /index.php -> index.php
[rid#47253575/initial/1] (3) [perdir d:\domain\] applying
pattern . to uri index.php
[rid#47253575/initial/1] (4) [perdir d:\domain\]
RewriteCond: input='d:\domain\index.php' pattern='-f' =>
not-matched


Edited by paladincomp - 28 February 2011 at 1:45am


__________________
Tom Nunamaker
Paladin Computers
www.paladincomputer.net
Back to Top Visit paladincomp's Homepage
 
Vyacheslav
Admin Group


Joined: 02 July 2008
Location: Ukraine
Posts: 1542
Posted: 28 February 2011 at 3:53am

Hello.
The syntax isn’t correct. You’ve probably been using ISAPI_Rewrite 2 previously. Take a look at the documentation of mod_rewrite.

Please try the following code:
Code:
RewriteEngine On
RewriteBase /

# Force full URL
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]

# URL REDIRECT URL
RewriteRule ^x/(.*) redirect.php?code=$1 [NC,NS,L]

# Wordpress
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]


__________________
Slavik Shynkarenko,
Helicon Tech.
Back to Top Visit Vyacheslav's Homepage
 
paladincomp
Newbie


Joined: 16 June 2006
Location: United States
Posts: 11
Posted: 28 February 2011 at 4:18am

Brilliant Slavik!

That worked perfectly!

I still have ISAPI rewrite installed on the server and have used it for several
years. Thanks for bringing my .htaccess up to date!



__________________
Tom Nunamaker
Paladin Computers
www.paladincomputer.net
Back to Top Visit paladincomp's Homepage
 

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

Printable version Printable version