Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use echo in .htaccess file ? #50

Open
Kooooooma opened this issue Jun 6, 2016 · 6 comments
Open

how to use echo in .htaccess file ? #50

Kooooooma opened this issue Jun 6, 2016 · 6 comments

Comments

@Kooooooma
Copy link

i had already installed echo module for my nginx, and also i can use the echo command in the main nginx config file nginx.conf. but when i use the seem command in my .htaccess file it dosent't work anymore.

please help me, thanks!

@agentzh
Copy link
Member

agentzh commented Jun 6, 2016

@komabeyond Well, I didn't know nginx supports .htaccess files like apache httpd.

@Kooooooma
Copy link
Author

@agentzh well, actually it supports. could u make some tests and let echo can work in the .htaccess file ?

@agentzh
Copy link
Member

agentzh commented Jun 7, 2016

@komabeyond You mean some 3rd-party modules? I've been working on the nginx core for 7 years now and I never see such things in the standard nginx distributions, ever.

@Kooooooma
Copy link
Author

Kooooooma commented Jun 8, 2016

@agentzh Ah... I think may be we are not in the same topic now, so, let me paste my nginx config file and my .htaccess file down here, this will be show u how i used the .htaccess file in the nginx config file and then u will be know what i am talking about.

nginx config file contents:

server {
location / {
....
# work better
echo "hi, koma";
}
...
include "/path/to/htaccess/.htaccess";
}

.htaccess file contents:

location ~ /stream/view {
#not work
echo "hi, koma, see u again..";
}

@rugk
Copy link

rugk commented Aug 14, 2016

Ha, that's really confusing.
So basically you must use the correct nginx syntax in the .htaccess file. That's why naming it like this is already misleading (as everybody else uses Apache syntax there).
In your case I would guess you do not need the RegExp location there and try location /stream/view { instead of location ~ /stream/view {. Don't know whether this fixes the problem, but it is a good thing to change in any way.

BTW: You can place code parts into newline/code/newline to show them nicely in Markdown here on GitHub.

@ryandesign
Copy link

Based on what you showed, the location directive in your .htaccess file isn't inside a server directive, but location directives must be inside server directives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants