• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 254
  • Last Modified:

Trying to redirect using mod_rewrite

okay, we are trying to use mod_rewrite to send all our files over to coldfusion file of ours.

What we would like to run is this...

[code]
RewriteEngine On
RewriteRule ^(.*)$ /error_docs/not_found.cfm?id=%{REQUEST_URI} [L]
[/code]

now, with this, i presume the following urls will go to this.....

http://www.iqdevs.com/howdy.html => http://www.iqdevs.com/error_docs/not_found?id=/howdy.html

http://www.iqdevs.com/hey/ => http://www.iqdevs.com/error_docs/not_found?id=/hey/

http://www.iqdevs.com/hey/a.html => http://www.iqdevs.com/error_docs/not_found?id=/hey/a.html

etc....

this is what we would like to get working....

however, when the previous code is placed in the .htaccess file, we get a "Internal Server Error".

What are we doing wrong?

When i run the code below, it runs fine:

[code]
RewriteEngine On
RewriteRule ^.$ /error_docs/not_found.cfm?id=%{REQUEST_URI} [L]
[/code]

but of course, this only redirects for a single character entered...of course. But, at least we know that some for of mod_rewrite runs on our server.

Is there anything special that we need to do w/ httpd.conf?

Any help would be gratefully appreciated.

Thanks,
Travis
0
iqDevs
Asked:
iqDevs
  • 2
2 Solutions
 
crackyCommented:
Have you tried using the backreference as a variable?

[code]
RewriteEngine On
RewriteRule ^(.*)$ /error_docs/not_found.cfm?id=$1
[/code]
0
 
ahoffmannCommented:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/error_docs/
RewriteRule ^(.*)$ /error_docs/not_found.cfm?id=$1 [L]
0
 
iqDevsAuthor Commented:
bah, figured it out

apparently my file path was messed up

[code]
RewriteEngine On
RewriteRule ^.$ error_docs/not_found.cfm?id=%{REQUEST_URI} [L]
[/code]

this seems to work great now.
0
 
ahoffmannCommented:
this works? fascinating, unbelievable, ..
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now