Feel a bit silly – a bit more googling turned up the answer I was after:
RedirectMatch ^/$ /git/
Basically redirecting the root, and only the root.
This code could do in a .htaccess
file (there is a tag for this, so I assume that is the original use case). But if you can edit ,the main server apache config then put it in the section for your website probably inside a <VirtualHost>
section.
The docs for RedirectMatch say that the context can be “server config, virtual host, directory, .htaccess”.
Related Posts:
- Redirect, Change URLs or Redirect HTTP to HTTPS in Apache – Everything You Ever Wanted to Know About mod_rewrite Rules but Were Afraid to Ask
- Redirect old php link to wordpress link in .htaccess
- Double slashes on WordPress Admin URL redirects to wp-login
- “Too many redirects” ONLY when trying to access wp-admin page
- WordPress Redirect All HTTP requests to HTTPS via .htaccess
- Old blog/ and blog/feed/ URLs not working after moving blog to top-level via .htaccess
- Force HTTPS using .htaccess – stuck in redirect loop
- PHP – redirect https to http and www to non-www
- 301 redirect not working through .htaccess
- multisite htaccess 301 redirects
- 302 redirect instead of 301 after switch to HTTPS
- W3 Total Cache Plugin with WP 3 MultiUser [closed]
- How do I skip wordpress’s 404 handling?
- Pages 404 in wordpress
- htaccess or redirect to cloak portion of a link?
- Domain redirect in WordPress multisite
- Redirect from https to http or from http to https? [closed]
- Redirect too many times htacces switching to https
- How to proxy local WP uploads folder to live site
- Can WordPress redirect to a “similar page” in case of 404 error
- Hacked website redirect, only on desktop, help with restoring it [closed]
- Sub-subdomain getting redirected to main domain
- How to hide that a certain non-WordPress directory exists on the server?
- Redirect “any page/page/number/” to “any page”
- How to create a 301 redirect that doesn’t apply to subsites
- Alias ‘wp-content’ directory to something shorter (framework?)
- WordPress multisite htaccess redirection to new domain
- WordPress blocking/preventing viewing of .cgi file in subdirectory [closed]
- https redirect (with .htaccess) redirect loop
- How to set up htaccess to redirect a particular post type or subdirectory to HTTPS?
- How to disable the default WordPress redirect to non-www URLs?
- Rule to redirect non logged in User to Custom Registration/login Page in .htaccess file
- Redirecting old post url to 404 in wordpress using htaccess
- How to redirect subcategories to a page?
- Use htaccess to redirect WordPress to static website in a subfolder
- Redirect blog archive into certain format
- CNAME vs A Record for WWW – with 301 Redirects
- How to publish new posts/pages in root instead of subfolder, but keep old structure in place?
- forward domain name to particular page?
- If I change permalink structures, can I use htaccess to permanantly redirect links?
- Redirect parent taxonomy to it’s child
- htaccess 301 Redirect not working for WordPress site
- Redirect only posts to New Domain
- Custom Permalink
- Redirect an old link to new site homepage [closed]
- WordPress category page redirects in .htaccess not working
- I need to redirect an entire subdirectory in WordPress to the homepage – is this correct?
- Redirecting old permalink structure to new in htaccess
- Multisite Redirection to new domains
- Redirect a Blogger Page URL to wordpress
- How to – proper WordPress 301 redirects?
- Redirecting /px/?q=x to /px/x/
- 301 (static page instead latest posts)
- WordPress: how to change URL for individual MultiSites?
- Htaccess https 301 problem
- URL redirect on updating the post date
- WordPress permalink, stop redirection
- Rewrite vs Redirect from ?p={ID}
- Is WordPress API visible from PHP file called in htaccess
- Force redirect single.php to index
- How to forward all requests starting with a specific folder name to the same folder
- I used single quote to design HTML of my WordPress blog. Now site redirects to index.php everytime than page.php or single.php
- Issue redirecting ‘blog’ to ‘news’ in WordPress using .htaccess
- Some Pemalink problems, probably caused by wrong .htaccess configuration?
- Use two different index pages
- Moving wordpress to different url/server creates redirect loop
- How to redirect an old page url to the homepage
- How to allow download url redirection only if user logged in WordPress site?
- Redirect old query string URLs to new add_rewrite_rule URL
- 301 Rewriting htaccess
- redirecting an entire WP site from one top level domain to another
- 404 redirect based on url
- Configuring Home Page Address
- Is there way to redirect all blog post pages to Home page?
- Working with Reverse Proxies and Multisite Installation
- Temporary Infinite Redirect Loop
- What’s the best way to manage a lot of 301 redirects in WordPress?
- A question about .htaccess
- ErrorDocument 410 gives me back a 302 header
- Error in /blog redirection – ubuntu default WP installation
- 302 redirect *.at/site redirecting to .comsite
- How to create multiple Rewrite-Rule for various site in single htaccess?
- Loading /wp-content/uploads/site as /site/
- WordPress Redirect / Add_Rewrite_Rule – Non Index.php Page
- How do I skip wordpress’s 404 handling?
- Redirect to homepage if attmpting to leave intranet [closed]
- How to 301 redirect to subdirectory but keep access to wp-admin of main domain
- Pagination redirect set in .htaccess file is not working
- redirect 301 with special character like WIX site “#!”
- Redirecting a POST to a php script
- Debugging a redirect loop affecting only certain pages
- Removed and Reinstalled WordPress, Redirect Broken now
- How to permanent redirect old domain to new one. in case amazon store
- redirect old pages by .htaccess
- Why are all pages redirecting to homepage when using custom permalinks?
- .htaccess regex for redirect subdomain to root domain & redirect old permalinks
- WordPress redirect from one directory to another but exclude wp-admin and wp-login.php
- Can I redirect the http request towards an old folder to the homepage using .htaccess file? [closed]
- How to use multiple 404 Error Pages in WordPress
- Redirect old homepage to the new one within the same site