How to redirect a URL in Nginx - Stack Overflow (../../../cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico@v=ec617d715196) (https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon.png?v=c78bd457575a) (https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon.png?v=c78bd457575a) (Stack Overflow) (https://stackoverflow.com/opensearch.xml) (how-to-redirect-a-url-in-nginx.html) (../../../cdn.sstatic.net/Shared/stacks.css@v=b2264ccf0463.css) (../../../cdn.sstatic.net/Sites/stackoverflow/primary.css@v=1172447e1393.css) (Feed for question 'How to redirect a URL in Nginx') (https://stackoverflow.com/feeds/question/10294481) (../../../cdn.sstatic.net/Shared/Channels/channels.css@v=2c98e83b4da0.css) (how-to-redirect-a-url-in-nginx.html#content) Skip to main content (how-to-redirect-a-url-in-nginx.html#) (https://stackoverflow.com) Stack Overflow (https://stackoverflow.co/) About Products (https://stackoverflow.co/teams/) For Teams (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=stack-overflow-for-teams) Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers (https://stackoverflow.co/advertising/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=stack-overflow-advertising) Advertising Reach devs & technologists worldwide about your product, service or employer brand (https://stackoverflow.co/api-solutions/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=overflow-api) Knowledge Solutions Data licensing offering for businesses to build and improve AI tools and models (https://stackoverflow.co/labs/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=labs) Labs The future of collective knowledge sharing (https://stackoverflow.co/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=about-the-company) About the company (https://stackoverflow.blog/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=blog) Visit the blog (Search…) () Loading… (https://stackoverflow.com) current community (https://stackoverflow.com) (Stack Overflow) Stack Overflow (https://stackoverflow.com/help) help (https://chat.stackoverflow.com/?tab=explore) chat (https://meta.stackoverflow.com) (Meta Stack Overflow) Meta Stack Overflow your communities (https://stackoverflow.com/users/signup?ssrc=site_switcher&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f10294481%2fhow-to-redirect-a-url-in-nginx) Sign up or (https://stackoverflow.com/users/login?ssrc=site_switcher&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f10294481%2fhow-to-redirect-a-url-in-nginx) log in to customize your list. (https://stackexchange.com/sites) more stack exchange communities (https://stackoverflow.blog) company blog (Click to show search) (https://stackoverflow.com/users/login?ssrc=head&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f10294481%2fhow-to-redirect-a-url-in-nginx) Log in (https://stackoverflow.com/users/signup?ssrc=head&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f10294481%2fhow-to-redirect-a-url-in-nginx) Sign up (https://stackoverflow.com/) Home (https://stackoverflow.com/questions) Questions (https://stackoverflow.ai) AI Assist Labs (https://stackoverflow.com/tags) Tags (https://stackoverflow.com/beta/challenges) Challenges (https://chat.stackoverflow.com/rooms/259507/stack-overflow-lobby) Chat (https://stackoverflow.blog/contributed?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=so-blog&utm_content=experiment-articles) Articles (https://stackoverflow.com/users) Users (https://stackoverflow.com/jobs?source=so-left-nav) Jobs (https://stackoverflow.com/jobs/companies?so_medium=stackoverflow&so_source=SiteNav) Companies Collectives Communities for your favorite technologies. (https://stackoverflow.com/collectives-all) Explore all Collectives Teams () Ask questions, find answers and collaborate at work with Stack Overflow for Teams. (https://stackoverflowteams.com/teams/create/free/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=side-bar&utm_content=explore-teams) Try Teams for free (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=side-bar&utm_content=explore-teams) Explore Teams Teams Ask questions, find answers and collaborate at work with Stack Overflow for Teams. (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=side-bar&utm_content=explore-teams-compact) Explore Teams Collectives™ on Stack Overflow Find centralized, trusted content and collaborate around the technologies you use most. (https://stackoverflow.com/collectives) Learn more about Collectives Teams Q&A for work Connect and share knowledge within a single location that is structured and easy to search. (https://stackoverflow.co/teams/) Learn more about Teams (https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon.png?v=c78bd457575a) (how-to-redirect-a-url-in-nginx.html) How to redirect a URL in Nginx (https://stackoverflow.com/questions/ask) Ask Question (2012-04-24 08:39:54Z) Asked 13 years, 5 months ago Modified (https://stackoverflow.com/questions/10294481/how-to-redirect-a-url-in-nginx?lastactivity) (2025-09-15 10:14:04Z) 20 days ago (Viewed 377,184 times) Viewed 377k times (This question shows research effort; it is useful and clear) (70:3:31e,16:f6a7ac05a77adac2,10:1759669183,16:0291a7e75313aea0,8:10294481,6f444ef84344b707a5070665273b47f1098c9ec85746cea6134d52d1f3463ea7) 168 (This question does not show any research effort; it is unclear or not useful) (70:3:31e,16:f804afa0e6f5e683,10:1759669183,16:34c080650ec1b217,8:10294481,b072b91f3c5efb82b1966c2f1787de6c6343a7e6e76247a78fc172161d8a907f) (Save this question.) (https://stackoverflow.com/posts/10294481/timeline) (Show activity on this post.) I need to redirect every (http://test.com) http://test.com request to (http://www.test.com) http://www.test.com . How can this be done. In the server block I tried adding rewrite ^/(.*) http://www.test.com/$1 permanent; but in browser it says The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. My server block looks like server { listen 80; server_name test.com; client_max_body_size 10M; client_body_buffer_size 128k; root /home/test/test/public; passenger_enabled on; rails_env production; #rewrite ^/(.*) http://www.test.com/$1 permanent; #rewrite ^(.*)$ $scheme://www.test.com$1; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } (https://stackoverflow.com/questions/tagged/http-redirect) (show questions tagged 'http-redirect') http-redirect (https://stackoverflow.com/questions/tagged/nginx) (show questions tagged 'nginx') nginx (https://stackoverflow.com/questions/tagged/url-rewriting) (show questions tagged 'url-rewriting') url-rewriting (https://stackoverflow.com/q/10294481) (Short permalink to this question) Share (https://stackoverflow.com/posts/10294481/edit) () Improve this question (Follow this question to receive notifications) Follow (70:3:31e,16:12e153f47cbbcddc,10:1759669183,16:ca42a83eef8a55a2,8:10294481,09eba6e5635372fd155101cc0705ca93c6a0595f237d0c14c1bfb0857327c21b) (https://stackoverflow.com/posts/10294481/revisions) (show all edits to this post) edited (2021-04-02 08:37:33Z) Apr 2, 2021 at 8:37 (https://stackoverflow.com/users/9193372/syscall) (Syscall's user avatar) (https://stackoverflow.com/users/9193372/syscall) Syscall (reputation score 19,783) 19.8k (10 gold badges) 10 10 gold badges (44 silver badges) 44 44 silver badges (60 bronze badges) 60 60 bronze badges asked (2012-04-24 08:39:54Z) Apr 24, 2012 at 8:39 (https://stackoverflow.com/users/457036/amal-kumar-s) (Amal Kumar S's user avatar) (https://stackoverflow.com/users/457036/amal-kumar-s) Amal Kumar S Amal Kumar S (reputation score 16,113) 16.1k (19 gold badges) 19 19 gold badges (59 silver badges) 59 59 silver badges (89 bronze badges) 89 89 bronze badges 1 The official documentation is at: (http://nginx.org/en/docs/http/converting_rewrite_rules.html) nginx.org/en/docs/http/converting_rewrite_rules.html Marcello Nuccio – (https://stackoverflow.com/users/453605/marcello-nuccio) (3,901 reputation) Marcello Nuccio 2017-05-16 23:51:55 +00:00 Commented (2017-05-16 23:51:55Z, License: CC BY-SA 3.0) May 16, 2017 at 23:51 (Use comments to ask for more information or suggest improvements. Avoid answering questions in comments.) (how-to-redirect-a-url-in-nginx.html#) Add a comment | (Expand to show all comments on this post) (how-to-redirect-a-url-in-nginx.html#) 5 Answers 5 Sorted by: (https://stackoverflow.com/questions/10294481/how-to-redirect-a-url-in-nginx?answertab=scoredesc#tab-top) Reset to default (scoredesc) Highest score (default) (trending) Trending (recent votes count more) (modifieddesc) Date modified (newest first) (createdasc) Date created (oldest first) (This answer is useful) (70:3:31e,16:c082e723ec8cbf6a,10:1759669183,16:fccae9b3257f98b7,8:10303879,30a12c389bb6ca2fa40e025355f82e772cab1f96d26f023f4b85ab3bb461105f) 316 (This answer is not useful) (70:3:31e,16:dd53952aa637064a,10:1759669183,16:334ff310d7513770,8:10303879,b8a921a2809d39d6212e20293b50bb826e16f135632ccb930d06f99394422935) (Save this answer.) (Loading when this answer was accepted…) (https://stackoverflow.com/posts/10303879/timeline) (Show activity on this post.) Best way to do what you want is to add another server block: server { #implemented by default, change if you need different ip or port #listen *:80 | *:8000; server_name test.com; return 301 $scheme://www.test.com$request_uri; } And edit your main server block server_name variable as following: server_name www.test.com; Important : New server block is the right way to do this, (https://www.nginx.com/resources/wiki/start/topics/depth/ifisevil/) if is evil . You must use locations and servers instead of if if it's possible. Rewrite is sometimes (https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/#taxing-rewrites) evil too , so replaced it with return . (https://stackoverflow.com/a/10303879) (Short permalink to this answer) Share (https://stackoverflow.com/posts/10303879/edit) () Improve this answer (Follow this answer to receive notifications) Follow (70:3:31e,16:36cc0624df3f5825,10:1759669183,16:f34f88df1bd94185,8:10303879,df6bf775455bc7de7f3042319e60ead376a92616342376c45cf445f7ce2c9fb8) (https://stackoverflow.com/posts/10303879/revisions) (show all edits to this post) edited (2017-02-18 02:21:50Z) Feb 18, 2017 at 2:21 (https://stackoverflow.com/users/7026879/coffeemakr) (coffeemakr's user avatar) (https://stackoverflow.com/users/7026879/coffeemakr) coffeemakr (reputation score) 328 (2 silver badges) 2 2 silver badges (12 bronze badges) 12 12 bronze badges answered (2012-04-24 18:29:54Z) Apr 24, 2012 at 18:29 (https://stackoverflow.com/users/961092/dmitry-verhoturov) (Dmitry Verhoturov's user avatar) (https://stackoverflow.com/users/961092/dmitry-verhoturov) Dmitry Verhoturov Dmitry Verhoturov (reputation score) 6,100 (2 gold badges) 2 2 gold badges (37 silver badges) 37 37 silver badges (42 bronze badges) 42 42 bronze badges Sign up to request clarification or add additional context in comments. 6 Comments Add a comment (https://stackoverflow.com/users/1282124/rccola) () RCCola (https://stackoverflow.com/users/1282124/rccola) RCCola (how-to-redirect-a-url-in-nginx.html#comment20840724_10303879) (2013-02-14T01:17:50.02Z) Over a year ago (Edited 3 times) You could also end that server block with return 301 http://wwww.test.com$request_uri; instead of the rewrite. 2013-02-14T01:17:50.02Z+00:00 21 Reply Copy link (https://stackoverflow.com/users/260365/jcotton) () JCotton (https://stackoverflow.com/users/260365/jcotton) JCotton (how-to-redirect-a-url-in-nginx.html#comment26485928_10303879) (2013-08-07T03:06:38.84Z) Over a year ago ditto @RCCola on using return instead of rewrite . See (http://wiki.nginx.org/Pitfalls#Taxing_Rewrites) docs 2013-08-07T03:06:38.84Z+00:00 6 Reply Copy link (https://stackoverflow.com/users/2797942/jhnferraris) () jhnferraris (https://stackoverflow.com/users/2797942/jhnferraris) jhnferraris (how-to-redirect-a-url-in-nginx.html#comment58605826_10303879) (2016-02-17T10:54:29.897Z) Over a year ago (Edited 2 times) Question, how should the server blocks be ordered? the redirect then the main server block or main server block then the redirect ? Because I have the same problem, (http://stackoverflow.com/questions/35451929/nginx-redirecting-non-www-to-www-with-request-uri-does-not-work) (nginx redirecting non www to www with request uri does not work) stackoverflow.com/questions/35451929/… 2016-02-17T10:54:29.897Z+00:00 0 Reply Copy link (https://stackoverflow.com/users/961092/dmitry-verhoturov) () Dmitry Verhoturov (https://stackoverflow.com/users/961092/dmitry-verhoturov) Dmitry Verhoturov (how-to-redirect-a-url-in-nginx.html#comment58714985_10303879) (2016-02-19T18:16:08.573Z) Over a year ago Nginx config in mentioned question is correct, order does not matter. 2016-02-19T18:16:08.573Z+00:00 0 Reply Copy link (https://stackoverflow.com/users/1057616/nick-m) () Nick M (https://stackoverflow.com/users/1057616/nick-m) Nick M (how-to-redirect-a-url-in-nginx.html#comment58767528_10303879) (2016-02-21T17:35:20.31Z) Over a year ago (Edited 1 time) Just a quick warning: Watch out for the 301 redirect vs the 302 . You could be stuck with a cached permanent redirect, which makes it very troublesome to change your settings for clients that have already accessed a URL. (I know the OP asked for a 301 , but be sure that's really what you want.) 2016-02-21T17:35:20.31Z+00:00 8 Reply Copy link Add a comment | Show 1 more comment (This answer is useful) (70:3:31e,16:2cb304d934d27e06,10:1759669183,16:580cd10c1364acb3,8:60420056,e68f559a08fba16921eda73d176ad840c575a232b0787e660ac57529e25a6157) 30 (This answer is not useful) (70:3:31e,16:744a436fa38e3d05,10:1759669183,16:96a221b75c077fc7,8:60420056,a39846e5091d195bf2453a60cd7c5c813f63465134720743140c07aa0ac0103d) (Save this answer.) (Loading when this answer was accepted…) (https://stackoverflow.com/posts/60420056/timeline) (Show activity on this post.) This is the top hit on Google for "nginx redirect". If you got here just wanting to redirect a single location: location = /content/unique-page-name { return 301 /new-name/unique-page-name; } (https://stackoverflow.com/a/60420056) (Short permalink to this answer) Share (https://stackoverflow.com/posts/60420056/edit) () Improve this answer (Follow this answer to receive notifications) Follow (70:3:31e,16:df8194d2816861f1,10:1759669183,16:0c144b04aa02969f,8:60420056,dab824e0b7ba9ff67bd5a13ec54981e377b1896174771692322e0b6c86018313) answered (2020-02-26 18:12:03Z) Feb 26, 2020 at 18:12 (https://stackoverflow.com/users/4808079/seph-reed) (Seph Reed's user avatar) (https://stackoverflow.com/users/4808079/seph-reed) Seph Reed Seph Reed (reputation score 11,424) 11.4k (15 gold badges) 15 15 gold badges (89 silver badges) 89 89 silver badges (157 bronze badges) 157 157 bronze badges 1 Comment Add a comment (https://stackoverflow.com/users/2977175/tofandel) () Tofandel (https://stackoverflow.com/users/2977175/tofandel) Tofandel (how-to-redirect-a-url-in-nginx.html#comment140692125_60420056) (2025-08-26T04:14:27.41Z) Aug 26 at 4:14 The '=' is not strictly necessary and you can of course edit 301 to 302 for a non permanent redirect 2025-08-26T04:14:27.41Z+00:00 0 Reply Copy link (This answer is useful) (70:3:31e,16:ae9268197a4623d3,10:1759669183,16:bcb21b9a0989fc55,8:17888296,2d5fe6c48e96eb6c3055620ec6fdd5cfa63e018a2ceb26908bbfa28c9ea4b35c) 18 (This answer is not useful) (70:3:31e,16:6def0e09d06d2648,10:1759669183,16:c320c7cf810aaf98,8:17888296,19a351c4fc692e19d6d2c720f9f30bd624555b2064c733ebfb32d0279a8d034a) (Save this answer.) (Loading when this answer was accepted…) (https://stackoverflow.com/posts/17888296/timeline) (Show activity on this post.) Similar to another answer here, but change the http in the rewrite to to $scheme like so: server { listen 80; server_name test.com; rewrite ^ $scheme://www.test.com$request_uri? permanent; } And edit your main server block server_name variable as following: server_name www.test.com; I had to do this to redirect www.test.com to test.com. (https://stackoverflow.com/a/17888296) (Short permalink to this answer) Share (https://stackoverflow.com/posts/17888296/edit) () Improve this answer (Follow this answer to receive notifications) Follow (70:3:31e,16:99e7c93d30cd259a,10:1759669183,16:9191b7fd6a8e34a2,8:17888296,32b8258de003da66afe241cb48f44ecacd06ec8c95e3e450ae78e08bff3903a3) answered (2013-07-26 18:17:56Z) Jul 26, 2013 at 18:17 (https://stackoverflow.com/users/1941743/damien-justin-%c5%a0utevski) (Damien Justin Šutevski's user avatar) (https://stackoverflow.com/users/1941743/damien-justin-%c5%a0utevski) Damien Justin Šutevski Damien Justin Šutevski (reputation score) 395 (5 silver badges) 5 5 silver badges (13 bronze badges) 13 13 bronze badges Comments Add a comment (This answer is useful) (70:3:31e,16:1b5bc28c890c1082,10:1759669183,16:bf678449fcf2d121,8:10295650,ce9d840583ccedc8580d8325104cd622a9aaf002d6f8b1bb4aa81a0116cb4618) 9 (This answer is not useful) (70:3:31e,16:ecb41685a06fa692,10:1759669183,16:03173e6385780800,8:10295650,dff19a281dcdfe6271e333de5af9c4d20f2bb96c2052202511d2edf24fbbccd7) (Save this answer.) (Loading when this answer was accepted…) (https://stackoverflow.com/posts/10295650/timeline) (Show activity on this post.) First make sure you have installed Nginx with the HTTP rewrite module. To install this we need to have pcre-library (http://www.asep.us/2011/05/30/nginx-instalation-pcre-library-not-found/) How to install pcre library If the above mentioned are done or if you already have them, then just add the below code in your nginx server block if ($host !~* ^www\.) { rewrite ^(.*)$ http://www.$host$1 permanent; } To remove www from every request you can use if ($host = 'www.your_domain.com' ) { rewrite ^/(.*)$ http://your_domain.com/$1 permanent; } so your server block will look like server { listen 80; server_name test.com; if ($host !~* ^www\.) { rewrite ^(.*)$ http://www.$host$1 permanent; } client_max_body_size 10M; client_body_buffer_size 128k; root /home/test/test/public; passenger_enabled on; rails_env production; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } (https://stackoverflow.com/a/10295650) (Short permalink to this answer) Share (https://stackoverflow.com/posts/10295650/edit) () Improve this answer (Follow this answer to receive notifications) Follow (70:3:31e,16:314a1e0934b1a48c,10:1759669183,16:5ffcf39eda2f75d6,8:10295650,38cfa99270d9fb9c73262edd013224929683a94807bb17b9cb707dd5f435cb9f) (https://stackoverflow.com/posts/10295650/revisions) (show all edits to this post) edited (2012-04-24 10:20:33Z) Apr 24, 2012 at 10:20 answered (2012-04-24 09:57:55Z) Apr 24, 2012 at 9:57 (https://stackoverflow.com/users/457036/amal-kumar-s) (Amal Kumar S's user avatar) (https://stackoverflow.com/users/457036/amal-kumar-s) Amal Kumar S Amal Kumar S (reputation score 16,113) 16.1k (19 gold badges) 19 19 gold badges (59 silver badges) 59 59 silver badges (89 bronze badges) 89 89 bronze badges Comments Add a comment (This answer is useful) (70:3:31e,16:94b89493169e8204,10:1759669183,16:322980ebdb7ae444,8:79241318,c654bc635b9b14cd2c70cd50350ebfaa30636b8d729a3147c1a9d898984121b8) 0 (This answer is not useful) (70:3:31e,16:652a1355d0daefb5,10:1759669183,16:d4f96aa326223631,8:79241318,66d500b69302915edb3155361c8ae65136484555dbcdb45654ad78db0e99a842) (Save this answer.) (Loading when this answer was accepted…) (https://stackoverflow.com/posts/79241318/timeline) (Show activity on this post.) This method works for me. return $scheme://$server_name/your_reqeust_uri_name.html; (https://stackoverflow.com/a/79241318) (Short permalink to this answer) Share (https://stackoverflow.com/posts/79241318/edit) () Improve this answer (Follow this answer to receive notifications) Follow (70:3:31e,16:cb17ae4780401d2e,10:1759669183,16:249fdd574b9a3dba,8:79241318,2d79621e9ebc23fe0e53b1d2bfc2f0bf466e373e99d70e7b9f6c7b419a7a0d74) (https://stackoverflow.com/posts/79241318/revisions) (show all edits to this post) edited (2025-01-31 02:00:04Z) Jan 31 at 2:00 (https://stackoverflow.com/users/16217248/cplus) (CPlus's user avatar) (https://stackoverflow.com/users/16217248/cplus) CPlus (reputation score) 5,085 (48 gold badges) 48 48 gold badges (33 silver badges) 33 33 silver badges (76 bronze badges) 76 76 bronze badges answered (2024-12-01 10:00:16Z) Dec 1, 2024 at 10:00 (https://stackoverflow.com/users/7835835/mark-alvin) (Mark Alvin's user avatar) (https://stackoverflow.com/users/7835835/mark-alvin) Mark Alvin Mark Alvin (reputation score) 107 (9 bronze badges) 9 9 bronze badges Comments Add a comment (10294481) (false) () (0) Your Answer (True) (how-to-redirect-a-url-in-nginx.html#) Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question . Provide details and share your research! But avoid … Asking for help, clarification, or responding to other answers. Making statements based on opinion; back them up with references or personal experience. To learn more, see our (https://stackoverflow.com/help/how-to-answer) tips on writing great answers . Draft saved Draft discarded (16a63166755f4bdd4f6a5c8fb8c4468cb19872abe0d4f9ac7bdb9620ffd88fbd) Sign up or (https://stackoverflow.com/users/login?ssrc=question_page&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f10294481%2fhow-to-redirect-a-url-in-nginx%23new-answer) log in Sign up using Google Sign up using Email and Password (false) (false) Submit Post as a guest Name () () Email Required, but never shown () () Post as a guest Name () () Email Required, but never shown () () Post Your Answer Discard By clicking “Post Your Answer”, you agree to our (https://stackoverflow.com/legal/terms-of-service/public) terms of service and acknowledge you have read our (https://stackoverflow.com/legal/privacy-policy) privacy policy .(1) Start asking to get answers Find the answer to your question by asking. (https://stackoverflow.com/questions/ask) Ask question Explore related questions (https://stackoverflow.com/questions/tagged/http-redirect) (show questions tagged 'http-redirect') http-redirect (https://stackoverflow.com/questions/tagged/nginx) (show questions tagged 'nginx') nginx (https://stackoverflow.com/questions/tagged/url-rewriting) (show questions tagged 'url-rewriting') url-rewriting See similar questions with these tags. The Overflow Blog (https://stackoverflow.blog/2025/10/03/one-is-not-the-loneliest-number-for-api-calls/) One is not the loneliest number for API calls Featured on Meta (Meta Stack Exchange) (https://meta.stackexchange.com/questions/412667/spevacus-has-joined-us-as-a-community-manager) Spevacus has joined us as a Community Manager (Meta Stack Exchange) (https://meta.stackexchange.com/questions/412705/introducing-a-new-proactive-anti-spam-measure) Introducing a new proactive anti-spam measure (Meta Stack Overflow) (https://meta.stackoverflow.com/questions/421831/policy-generative-ai-e-g-chatgpt-is-banned) Policy: Generative AI (e.g., ChatGPT) is banned (Meta Stack Overflow) (https://meta.stackoverflow.com/questions/435121/exploring-new-types-of-questions-on-stack-overflow) Exploring new types of questions on Stack Overflow (https://chat.stackoverflow.com/) Visit chat Linked (https://stackoverflow.com/questions/2068418/whats-the-difference-between-a-302-and-a-307-redirect) (Question score (upvotes - downvotes)) 306 (https://stackoverflow.com/questions/2068418/whats-the-difference-between-a-302-and-a-307-redirect?noredirect=1) What's the difference between a 302 and a 307 redirect? (https://stackoverflow.com/questions/35038155/how-to-redirect-all-angular-request-to-index-html-in-nginx) (Question score (upvotes - downvotes)) 24 (https://stackoverflow.com/questions/35038155/how-to-redirect-all-angular-request-to-index-html-in-nginx?noredirect=1) How to redirect all Angular request to index.html in Nginx (https://stackoverflow.com/questions/22993669/route-a-specific-path-to-a-specific-ec2-instance-using-route-53) (Question score (upvotes - downvotes)) 7 (https://stackoverflow.com/questions/22993669/route-a-specific-path-to-a-specific-ec2-instance-using-route-53?noredirect=1) Route a specific path to a specific EC2 instance using Route 53 (https://stackoverflow.com/questions/38517948/how-to-redirect-url-with-parameters-in-nginx) (Question score (upvotes - downvotes)) 3 (https://stackoverflow.com/questions/38517948/how-to-redirect-url-with-parameters-in-nginx?noredirect=1) How to redirect url with parameters in nginx (https://stackoverflow.com/questions/19604658/firefox-redirecting-nginx-rewrite) (Question score (upvotes - downvotes)) 2 (https://stackoverflow.com/questions/19604658/firefox-redirecting-nginx-rewrite?noredirect=1) Firefox redirecting Nginx rewrite (https://stackoverflow.com/questions/13283925/opening-other-websites-links-in-nginx-server) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/13283925/opening-other-websites-links-in-nginx-server?noredirect=1) opening other websites links in nginx server (https://stackoverflow.com/questions/22014392/is-it-possible-to-set-up-a-redirection-rules-outside-rails-application) (Question score (upvotes - downvotes)) -1 (https://stackoverflow.com/questions/22014392/is-it-possible-to-set-up-a-redirection-rules-outside-rails-application?noredirect=1) Is it possible to set up a redirection rules outside Rails application? (https://stackoverflow.com/questions/27974550/nginx-setting-multiple-redirects) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/27974550/nginx-setting-multiple-redirects?noredirect=1) NginX: Setting multiple redirects (https://stackoverflow.com/questions/31692048/nginx-how-do-i-redirect-a-url-to-a-specific-page) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/31692048/nginx-how-do-i-redirect-a-url-to-a-specific-page?noredirect=1) nginx how do I redirect a url to a specific page (https://stackoverflow.com/questions/42420753/make-nginx-redirect-http-example-com-profile-to-http-example-com-profile) (Question score (upvotes - downvotes)) 1 (https://stackoverflow.com/questions/42420753/make-nginx-redirect-http-example-com-profile-to-http-example-com-profile?noredirect=1) Make Nginx redirect http://example.com/profile to http://example.com/#/profile (angular route)? (https://stackoverflow.com/questions/linked/10294481) See more linked questions Related (https://stackoverflow.com/questions/3519495/redirect-urls-in-nginx) (Question score (upvotes - downvotes)) 1 (https://stackoverflow.com/questions/3519495/redirect-urls-in-nginx) Redirect urls in nginx (https://stackoverflow.com/questions/11814438/nginx-redirect-to-an-external-url) (Question score (upvotes - downvotes)) 6 (https://stackoverflow.com/questions/11814438/nginx-redirect-to-an-external-url) Nginx redirect to an external URL (https://stackoverflow.com/questions/14509794/redirect-with-nginx) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/14509794/redirect-with-nginx) Redirect with nginx (https://stackoverflow.com/questions/18037716/how-to-redirect-single-url-in-nginx) (Question score (upvotes - downvotes)) 128 (https://stackoverflow.com/questions/18037716/how-to-redirect-single-url-in-nginx) How to redirect single URL in Nginx? (https://stackoverflow.com/questions/18810865/redirect-a-specific-url-to-another-in-nginx) (Question score (upvotes - downvotes)) 4 (https://stackoverflow.com/questions/18810865/redirect-a-specific-url-to-another-in-nginx) Redirect a specific URL to another in NGINX (https://stackoverflow.com/questions/26221583/nginx-redirect-with-rewrite) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/26221583/nginx-redirect-with-rewrite) Nginx redirect with rewrite (https://stackoverflow.com/questions/28511710/nginx-redirect-old-url-to-new-url) (Question score (upvotes - downvotes)) 1 (https://stackoverflow.com/questions/28511710/nginx-redirect-old-url-to-new-url) nginx redirect old URL to new URL (https://stackoverflow.com/questions/38517948/how-to-redirect-url-with-parameters-in-nginx) (Question score (upvotes - downvotes)) 3 (https://stackoverflow.com/questions/38517948/how-to-redirect-url-with-parameters-in-nginx) How to redirect url with parameters in nginx (https://stackoverflow.com/questions/43840628/how-should-i-redirect-the-url-with-parameters-in-nginx) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/43840628/how-should-i-redirect-the-url-with-parameters-in-nginx) How should I redirect the url with parameters in nginx? (https://stackoverflow.com/questions/57173419/redirect-uri-on-nginx) (Question score (upvotes - downvotes)) 1 (https://stackoverflow.com/questions/57173419/redirect-uri-on-nginx) Redirect URI on NGINX (https://stackexchange.com/questions?tab=hot) Hot Network Questions (Home Improvement Stack Exchange) (https://diy.stackexchange.com/questions/323383/is-there-any-technique-or-secret-to-keep-switches-flat-not-yawd-when-pushing) Is there any technique or secret to keep switches flat (not yaw'd) when pushing them in then screwing them down? (Role-playing Games Stack Exchange) (https://rpg.stackexchange.com/questions/216735/how-to-start-a-campaign-with-the-pcs-exiting-a-stasis-effect) How to start a campaign with the PCs exiting a stasis effect? (English Language & Usage Stack Exchange) (https://english.stackexchange.com/questions/633357/use-of-interesting-state-for-pregnancy) Use of 'interesting state' for pregnancy (German Language Stack Exchange) (https://german.stackexchange.com/questions/80761/is-das-fotos-in-this-paragraph-correct) Is “das Fotos” in this paragraph correct? (Software Engineering Stack Exchange) (https://softwareengineering.stackexchange.com/questions/459257/in-an-enterprise-software-team-is-it-recommended-for-developers-to-maintain-a-b) In an enterprise software team, is it recommended for developers to maintain a business knowledge wiki to understand domain concepts and processes? (Physics Stack Exchange) (https://physics.stackexchange.com/questions/860234/energy-density-using-nuclear-bonds-as-battery-instead-of-ionic-bonds) Energy density, using nuclear bonds as battery instead of ionic bonds (Music: Practice & Theory Stack Exchange) (https://music.stackexchange.com/questions/141522/for-the-chord-c7-specifically-add-a-6th-note-can-change-its-function) For the chord C7 (specifically!), add a 6th note can change its function? (Electrical Engineering Stack Exchange) (https://electronics.stackexchange.com/questions/756454/which-capacitor-to-use-evaluating-capacitance) Which capacitor to use? Evaluating Capacitance (Philosophy Stack Exchange) (https://philosophy.stackexchange.com/questions/130901/are-physical-coin-toss-sequences-really-equally-unlikely) Are physical coin toss sequences really equally unlikely? (Role-playing Games Stack Exchange) (https://rpg.stackexchange.com/questions/216728/what-attributes-and-skills-are-most-common-in-rpg-systems) What attributes and skills are most common in RPG systems? (Biblical Hermeneutics Stack Exchange) (https://hermeneutics.stackexchange.com/questions/108634/what-is-the-absolute-earliest-and-absolute-latest-dates-the-gospel-of-john-could) What is the absolute earliest and absolute latest dates the Gospel of John could possibly have been written? (Puzzling Stack Exchange) (https://puzzling.stackexchange.com/questions/133447/mystery-graph-whats-the-equation) Mystery graph. What's the equation? (Travel Stack Exchange) (https://travel.stackexchange.com/questions/200363/how-to-prepare-my-belongings-in-bali-to-store-them-for-a-few-months) How to prepare my belongings in Bali to store them for a few months? (Christianity Stack Exchange) (https://christianity.stackexchange.com/questions/108927/do-jehovahs-witnesses-claim-a-unique-source-of-divine-authority) Do Jehovah's Witnesses claim a unique source of divine authority? (History of Science and Mathematics Stack Exchange) (https://hsm.stackexchange.com/questions/18921/when-did-equations-begin-to-break-away-from-geometry) When did equations begin to break away from geometry? (TeX - LaTeX Stack Exchange) (https://tex.stackexchange.com/questions/751999/use-antykwatorunska-with-unicode-math) Use AntykwaTorunska with unicode math (Mathematica Stack Exchange) (https://mathematica.stackexchange.com/questions/315592/is-it-possible-to-make-the-top-and-bottom-of-barlegend-pointy) Is it possible to make the top and bottom of barlegend pointy? (Home Improvement Stack Exchange) (https://diy.stackexchange.com/questions/323368/cinderblocks-missing-in-two-corners-of-my-house) Cinderblocks missing in two corners of my house (Unix & Linux Stack Exchange) (https://unix.stackexchange.com/questions/800197/how-to-add-tar-gz-archive-to-an-ar-archive) How to add tar.gz archive to an ar archive? (Travel Stack Exchange) (https://travel.stackexchange.com/questions/200351/how-to-get-free-tourist-transport-pass-in-geneva) How to get free tourist transport pass in Geneva (Mathematics Stack Exchange) (https://math.stackexchange.com/questions/5099920/is-%e2%84%9d-uniquely-determined-by-the-point-removal-splits-it-into-two-copies-of-itse) Is ℝ uniquely determined by the “point removal splits it into two copies of itself” property? (Physics Stack Exchange) (https://physics.stackexchange.com/questions/860354/can-spin-really-be-measured-in-an-arbitrary-direction) Can spin really be measured in an arbitrary direction? (Mathematics Stack Exchange) (https://math.stackexchange.com/questions/5099644/whats-the-easiest-way-to-help-a-high-schooler-understand-how-to-avoid-the-trap) What's the easiest way to help a high schooler understand how to avoid the trap of extraneous and missing solutions? (Retrocomputing Stack Exchange) (https://retrocomputing.stackexchange.com/questions/32120/where-does-the-unix-pack-compressor-come-from) Where does the Unix pack compressor come from? (how-to-redirect-a-url-in-nginx.html#) more hot questions (https://stackoverflow.com/feeds/question/10294481) (Feed of this question and its answers) Question feed Subscribe to RSS Question feed To subscribe to this RSS feed, copy and paste this URL into your RSS reader. (https://stackoverflow.com/feeds/question/10294481) (how-to-redirect-a-url-in-nginx.html#) () (https://stackoverflow.com) (https://stackoverflow.com) Stack Overflow (https://stackoverflow.com/questions) Questions (https://stackoverflow.com/help) Help (https://chat.stackoverflow.com/?tab=explore) Chat (https://stackoverflow.co/) Products (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=teams) Teams (https://stackoverflow.co/advertising/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=advertising) Advertising (https://stackoverflow.co/advertising/employer-branding/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=talent) Talent (https://stackoverflow.co/) Company (https://stackoverflow.co/) About (https://stackoverflow.co/company/press/) Press (https://stackoverflow.co/company/work-here/) Work Here (https://stackoverflow.com/legal) Legal (https://stackoverflow.com/legal/privacy-policy) Privacy Policy (https://stackoverflow.com/legal/terms-of-service/public) Terms of Service (https://stackoverflow.com/contact) Contact Us Your Privacy Choices (https://policies.stackoverflow.co/stack-overflow/cookie-policy) Cookie Policy (https://stackexchange.com) Stack Exchange Network (https://stackexchange.com/sites#technology) Technology (https://stackexchange.com/sites#culturerecreation) Culture & recreation (https://stackexchange.com/sites#lifearts) Life & arts (https://stackexchange.com/sites#science) Science (https://stackexchange.com/sites#professional) Professional (https://stackexchange.com/sites#business) Business (https://api.stackexchange.com/) API (https://data.stackexchange.com/) Data (https://stackoverflow.blog?blb=1) Blog (https://www.facebook.com/officialstackoverflow/) Facebook (https://twitter.com/stackoverflow) Twitter (https://linkedin.com/company/stack-overflow) LinkedIn (https://www.instagram.com/thestackoverflow) Instagram Site design / logo © 2025 Stack Exchange Inc; user contributions licensed under (https://stackoverflow.com/help/licensing) CC BY-SA . rev 2025.10.2.34811