LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   ScriptAliasMatch apache (https://www.linuxquestions.org/questions/linux-newbie-8/scriptaliasmatch-apache-933577/)

adam_1784 03-09-2012 04:58 AM

ScriptAliasMatch apache
 
ScriptAliasMatch ^/~([a-zA-Z0-9]+)/cgi-bin/(.+) /home/$1/cgi-bin/$2

will map a request to http://example.com/~user/cgi-bin/script.cgi to the path /home/user/cgi-bin/script.cgi and will treat the resulting file as a CGI script.

I want to access http://example.com/cgi-bin/script.cgi as my path is /home/user/www/cgi-bin/script.cgi what changes i have to make in ScriptAliasMatch condition.

bathory 03-09-2012 07:43 AM

Hi,

If you want to map the main apache cgi-bin directory to a specific user cgi-bin directory you don't need ScriptAliasMatch. ScriptAlias is enough
Code:

ScriptAlias /cgi-bin/ "/home/user/www/cgi-bin/"
If you insist, you can use:
Code:

ScriptAliasMatch ^/cgi-bin/(.*) "/home/user/public_html/cgi-bin/$1
Regards

adam_1784 03-12-2012 06:08 AM

Thanks for the help.

I try both the option but it did not work .
I also try this one

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !~
RewriteCond %{REQUEST_URI} ^\/.*\.pl$
RewriteCond %{DOCUMENT_ROOT} \/home\/mst3k\/public_html
RewriteRule ^(.*)$ /~mst3k/$1 [L]

but it also didnt work

bathory 03-12-2012 07:12 AM

What exactly are you trying to do and how it's not working. Check apache logs to see what's happening
If you want a request for http://example.com/cgi-bin/script.cgi to be served from the cgi directory in /home/mst3k/public_html/cgi-bin, then you need the just ScriptAlias above modified like this (added the specific username)
Code:

ScriptAlias /cgi-bin/ /home/mst3k/public_html/cgi-bin/


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