?
Solved

Redirect a file in nginx

Posted on 2010-09-01
4
Medium Priority
?
474 Views
Last Modified: 2012-05-10
i want to redirect www.site.com/page.html to look for the page in the folders ROOT/php/inc/page.html
this i want to be done in nginx

i have tried with
 rewrite  ^/page.html$ /php/inc/page.php break; .. but with no results

any ideas ?
regards
0
Comment
Question by:rares_dumitrescu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 9

Expert Comment

by:jeremycrussell
ID: 33577375
Can you not just put something like:

<meta http-equiv="refresh" content="2;url=/php/inc/pack.php">

In the page.html, and just let the client handle it?
0
 

Author Comment

by:rares_dumitrescu
ID: 33577616
i don't want page.html to exist on the document root
0
 

Accepted Solution

by:
Korcan earned 1000 total points
ID: 33583505
Its not redirect its Rewrite.


rewrite ^/page.html.*$ /php/inc/page.php last;

The arguments are depend on .htaccess's location.
If .htaccess is in /dir/ then the rule should probably be:

rewrite ^/dir/page.html.*$ /dir/php/inc/page.php last;
0
 
LVL 3

Assisted Solution

by:fernandomerces
fernandomerces earned 1000 total points
ID: 33583541
Well, I never used Nginx, but remember that rewrite module works with regexp, so, the dot is a special character. I think you need to escape it:

rewrite  ^/page\.html$ /php/inc/page.php break;

Reference: http://wiki.nginx.org/NginxHttpRewriteModule

Regards,

Fernando
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question