• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • 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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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