This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 3.0
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: Redirect all request for directory to new Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
mightyaswell
Newbie
Newbie


Joined: 26 January 2012
Location: United States
Online Status: Offline
Posts: 5
Posted: 26 January 2012 at 2:12pm | IP Logged Quote mightyaswell

I used to have a ton of pdf files in a directory like
this:

http://www.mysite.com/pubs/xxxxx.pdf

I want to redirect any request for content in the /pubs
directory to a url like /404/?pub=xxxxx.pdf

so

http://www.mysite.com/pubs/xxxxxx.pdf is redirected to:

http://www.mysite.com/404/?pub=xxxxxx.pdf

Possible?



Edited by mightyaswell - 26 January 2012 at 2:12pm
Back to Top View mightyaswell's Profile Search for other posts by mightyaswell
 
Guests
Guest
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -149
Posted: 27 January 2012 at 5:03am | IP Logged Quote Guests

Hello,

Please, try using:

Code:
RewriteEngine on
RewriteBase /

RewriteRule ^pubs/(.+)\.pdf$ /404/?pub=$1.pdf [NC,R=301,L]


Regards
Andrew
Back to Top View Guests's Profile Search for other posts by Guests
 
mightyaswell
Newbie
Newbie


Joined: 26 January 2012
Location: United States
Online Status: Offline
Posts: 5
Posted: 27 January 2012 at 11:26am | IP Logged Quote mightyaswell

Hi Andrew,

The RewriteBase / seems to cause everything to redirect
to my 404

There is actually no /pubs folder (or pdfs) on the
server, they have been removed but old search engines
still have links...

Will the rewrite happen before the 404 error?

Heres my current config file:



Code:

<VirtualHost www.mysite.com>
RewriteEngine On

RewriteRule ^pubs/(.+)\.pdf$ /404/?pub=$1.pdf
[NC,R=301,L]

# Ignore dirctories from FarCry Friendly URL processing

RewriteCond %{REQUEST_URI} !(^/pubs|^/_devel|)($|/)

RewriteRule ^([a-zA-Z0-9\/\-\%:\[\]\{\}\|\;\<\>\?
\,\*\!\@\#\$\ \(\)\^_`~]*)$ /index.cfm?furl=$1 [L,PT,QSA]

RewriteCond %{HTTP:User-Agent}
(?:YodaoBot|Yeti|ZmEu|Morfeus\f**king\Scanner) [NC]

RewriteRule .? - [F] RewriteLog Level 9 LogLevel debug

</VirtualHost>


Edited by mightyaswell - 27 January 2012 at 11:26am
Back to Top View mightyaswell's Profile Search for other posts by mightyaswell
 
Guests
Guest
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -149
Posted: 30 January 2012 at 3:55am | IP Logged Quote Guests

Rewrite occurs first. Please, provide the rewrite.log for the testing request.
Logging issues described in FAQ

Regards
Andrew
Back to Top View Guests's Profile Search for other posts by Guests
 
mightyaswell
Newbie
Newbie


Joined: 26 January 2012
Location: United States
Online Status: Offline
Posts: 5
Posted: 30 January 2012 at 1:30pm | IP Logged Quote mightyaswell

Andrew,

You original code suggestion works, the problem I seem to
have is that request for the root level such as
www.mysite.com does not work when I have the ReWriteBase /
set. There must be a conflict with my content managment's
url system.

Back to Top View mightyaswell's Profile Search for other posts by mightyaswell
 
Guests
Guest
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -149
Posted: 31 January 2012 at 3:12am | IP Logged Quote Guests

Hello,

'RewriteBase /' itself doesn't do anything. Please, see the documentation.
Please, provide the rewrite.log for the testing request.

Regards
Andrew
Back to Top View Guests's Profile Search for other posts by Guests
 
mightyaswell
Newbie
Newbie


Joined: 26 January 2012
Location: United States
Online Status: Offline
Posts: 5
Posted: 31 January 2012 at 11:46am | IP Logged Quote mightyaswell

Andrew,

No rewritelog entries are created (I have followed the
docs for logging, and error.log is working fine but
indicates no issue)..

I think the ReWriteBase / causes a problem with this rule
used by my content management system:

Code:

# Ignore dirctories from FarCry Friendly URL processing
RewriteCond %{REQUEST_URI} !(^/_devel)($|/)
RewriteRule ^([a-zA-Z0-9\/\-\%:\[\]\{\}\|\;\<\>\?
\,\*\!\@\#\$\ \(\)\^_`~]*)$ /index.cfm?furl=$1 [L,PT,QSA]



Code:

# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.59
# Registration info
RegistrationName= XX
RegistrationCode= XXX
# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.59
<VirtualHost www.mysite.com>

RewriteEngine On

# Send away some bots
RewriteCond %{HTTP:User-Agent}
(?:YodaoBot|Yeti|ZmEu|Morfeus\f**king\Scanner) [NC]
RewriteRule .? - [F]
# Ignore dirctories from FarCry Friendly URL processing
RewriteCond %{REQUEST_URI} !(^/_devel)($|/)
RewriteRule ^([a-zA-Z0-9\/\-\%:\[\]\{\}\|\;\<\>\?
\,\*\!\@\#\$\ \(\)\^_`~]*)$ /index.cfm?furl=$1 [L,PT,QSA]
# redirect all request of pubs folder to 404 page with
query string

RewriteBase /
RewriteRule ^pubs/(.+)\.pdf$ /404/?pub=$1.pdf
[NC,R=301,L]
#enabling rewrite.log
RewriteLogLevel 9
#enabling error.log
LogLevel debug
</VirtualHost>
Back to Top View mightyaswell's Profile Search for other posts by mightyaswell
 
Guests
Guest
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -149
Posted: 01 February 2012 at 5:33am | IP Logged Quote Guests

Issues with rewrite.log are caused by permissions, Please, see the following article.
What does error.log say?

We need to see the request processing to identify problem.

regards
Andrew
Back to Top View Guests's Profile Search for other posts by Guests
 
mightyaswell
Newbie
Newbie


Joined: 26 January 2012
Location: United States
Online Status: Offline
Posts: 5
Posted: 03 February 2012 at 11:28am | IP Logged Quote mightyaswell

I solved this problem by adding ^/$ to the ReWriteCond that
my CMS uses to friendly urls. such has below.

RewriteCond %{REQUEST_URI} !(^/$|^/pubs|^/_devel|^/farcry)
($|/)

Thanks!
Back to Top View mightyaswell's Profile Search for other posts by mightyaswell
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You can vote in polls in this forum