LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Apache redirects?! How (https://www.linuxquestions.org/questions/linux-software-2/apache-redirects-how-293759/)

rincewind 02-23-2005 04:12 AM

Apache redirects?! How
 
Hello,


Is there possible to redirect an URL in apache to another url..

Lets say that i got the url trail

/demo/mysite/pic/58.jpg

and want to redirect all of the 58.jpg to
/demo/mysite/?showdbimage=58

/demo/mysite/pic/X.jpg
should go to
/demo/mysite/?showdbimage=X


And make that apply to all of my sites under /demo

?
Is this possible to do from a .htaccess file (I now NOTHING about thes .htacces files)..=)


Thankful for help,
Regards..
-- Rincewind

linuxxed 02-23-2005 06:40 AM

Have you looked at mod_rewrite apache module?

http://httpd.apache.org/docs/mod/mod_rewrite.html

rincewind 02-23-2005 07:35 AM

Yeah.. Thanks.. That helped a lot!!!=)

Another question though...


if I have in one of the dir a .htaccess file that looks like this:
Code:

RewriteEngine On
RewriteRule ^/pics/(.*)\.jpg$ /?showdbimage=$1

it deos not work..
Any suggestions?

Im working in www.foo.bar/demo/mysite/
Im thinking it has to do that im not in the root directory www.foo.bar..?

Does anyone have any hints for me on how to fix this??
Thanks..
-- Rincewind

linuxxed 02-23-2005 02:43 PM

Check if you've got "AllowOverride None" in your httpd.conf. If yes then it will ignore .htaccess.

Increase log level - think it is RewriteLogLevel. Check logs to see how it is rewriting and why ..


All times are GMT -5. The time now is 01:46 PM.