New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Need Help in Nginx Rewrite Rule
Hello There,
I need some help in creating rewrite rule for Nginx
Currently i am running Nginx as front end proxy for Apache...
I want to create rewrite rule in nginx..
for example i want http://domain-name/client should open http://domain-name/directory/sub-directory/index.html
please help..
Comments
rewrite ^/client$ /directory/sub-directory/index.html;
@Rallias Thanks, i just have to edit this line and should place this in nginx server block na...
Tis the name of the game.
@Rallias
Please check this...
server {
listen 80;
server_name localhost;
rewrite ^/client$ /var/www/iptv/c/index.html;
}
its not working...
I think the rewrite rule by @Rallias is correct. You have applied the rule incorrectly because "/directory/sub-directory/index.html" does not include root directory but inside root directory instead. That means "rewrite ^/client$ /var/www/iptv/c/index.html;" has to be changed to "rewrite ^/client$ /iptv/c/index.html;" The root directory "/var/www" has to be excluded.
@Rallias ,@tdc_adm
Here is my working config:-
server {
listen 80;
server_name localhost;
root /var/www;
rewrite ^/client$ /iptv/c;
}
but now when i access http://ip/client then link in browser is automatically converted to http://ip:8901/iptv/c
Give this a try:
`
server {
listen 80;
server_name localhost;
root /var/www;
index index.php index.html index.htm;
}
`
Also clear your browser cache then restart it.
@tdc_adm
URL in browser is still being changed.