# .htaccess ignored by hugo serve?

**URL:** <https://discourse.gohugo.io/t/htaccess-ignored-by-hugo-serve/48321>\
**Category:** support\
**Created:** [February 17, 2024, 4:55pm UTC](https://discourse.gohugo.io/t/htaccess-ignored-by-hugo-serve/48321 "2024-02-17T16:55:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bfredo123](https://avatars.discourse-cdn.com/v4/letter/b/67e7ee/32.png) [@Bfredo123](https://discourse.gohugo.io/u/Bfredo123)\
**Post date:** [February 17, 2024, 4:55pm UTC](https://discourse.gohugo.io/t/htaccess-ignored-by-hugo-serve/48321/1 "2024-02-17T16:55:06Z")

</div>

Hi,

I have a `.htaccess` file in the `static` directory. It looks like it is not taken into account when I run `hugo serve` (however it works once in production).

Is there a way to have it taken into account during development with `hugo serve`?  
It would be quite helpful to test things like redirections, headers set on some resources, etc.

Many thanks!

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [February 17, 2024, 4:58pm UTC](https://discourse.gohugo.io/t/htaccess-ignored-by-hugo-serve/48321/2 "2024-02-17T16:58:57Z")

</div>

> [@Bfredo123](#):
>
> Is there a way to have it taken into account during development with `hugo serve`?

No, there is not. If you need to test an .htaccess file you should locally install the server you use in production.

---

<div class="post-metadata">

**Author:** ![Bfredo123](https://avatars.discourse-cdn.com/v4/letter/b/67e7ee/32.png) [@Bfredo123](https://discourse.gohugo.io/u/Bfredo123)\
**Post date:** [February 17, 2024, 5:32pm UTC](https://discourse.gohugo.io/t/htaccess-ignored-by-hugo-serve/48321/3 "2024-02-17T17:32:50Z")

</div>

Many thanks Jmooring! Good to know.

---

<div class="post-metadata">

**Author:** ![chrillek](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/chrillek/32/19797_2.png) [@chrillek](https://discourse.gohugo.io/u/chrillek)\
**Post date:** [February 17, 2024, 7:08pm UTC](https://discourse.gohugo.io/t/htaccess-ignored-by-hugo-serve/48321/4 "2024-02-17T19:08:43Z")

</div>

`.htaccess` is a peculiarity of the Apache web server. It has nothing to do with Hugo. You must test your redirections, headers and “resources” in production.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [February 19, 2024, 7:08pm UTC](https://discourse.gohugo.io/t/htaccess-ignored-by-hugo-serve/48321/5 "2024-02-19T19:08:47Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
