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
- How to redirect all HTTP requests to HTTPS
- htaccess – Redirect to subfolder without changing browser URL
- Generic htaccess redirect www to non-www
- Redirect old php link to wordpress link in .htaccess
- Redirect old php link to wordpress link in .htaccess
- Safely redirect old WordPress blog links to new WP blog
- Double slashes on WordPress Admin URL redirects to wp-login
- Cant login to wp-admin (redirecting to homepage), But CAN login to wp-login.php
- Cant login to wp-admin (redirecting to homepage), But CAN login to wp-login.php
- “Too many redirects” ONLY when trying to access wp-admin page
- How do I skip wordpress’s 404 handling and redirect all 404 errors for static files to 404.html?
- WordPress Redirect All HTTP requests to HTTPS via .htaccess
- Redirect entire website to a single page
- Stop WordPress and Plugins from Overwriting .htaccess
- 301 Redirects for Changed Permalink Structure & Category Base
- Old blog/ and blog/feed/ URLs not working after moving blog to top-level via .htaccess
- Non-WordPress page in subdirectory under WordPress page
- Force HTTPS using .htaccess – stuck in redirect loop
- PHP – redirect https to http and www to non-www
- How do I turn off 301 redirecting posts (not canonical)?
- Passing variables through permalink structure
- Redirecting WordPress /.htaccess / HSTS / SSL
- 301 redirect not working through .htaccess
- Wrong canonical link on wp-admin pages
- Site redirects to wrong url when saving settings
- WordPress Multisite – Multiple subfolders for blogs
- WordPress multisite subdirectory redirect infinite loop issue
- multisite htaccess 301 redirects
- How to redirect url requests to https? [closed]
- Htaccess redirect from ‘/%postname%.html’ to ‘/%postname%’
- Redirecting old permalink to new one
- Index in root, wordpress in subdirectory
- Redirect www to non-www htaccess
- 302 redirect instead of 301 after switch to HTTPS
- W3 Total Cache Plugin with WP 3 MultiUser [closed]
- Specific URL has 403 Forbidden status code
- How do I skip wordpress’s 404 handling?
- How to: 301 Redirect /category/ to /customname/
- Pages 404 in wordpress
- How to? Redirect /category/sci-fi/ to /category/scifi/?
- htaccess or redirect to cloak portion of a link?
- Domain redirect in WordPress multisite
- Problem to redirect custom page using htaccess
- Auto 301 to full post permalink? (using /posts/%post_id%/%postname%)
- Can’t access admin dashboard with wp-admin without /index.php after it
- htaccess redirect not working
- htaccess wildcard redirect misses some URLs
- Redirecting all old links from previous EE site to new WP site in one go?
- Server (WordPress) redirects files that are not supposed to (using htaccess)
- Redirect from https to http or from http to https? [closed]
- Redirect too many times htacces switching to https
- Why wordpress multisite redirect to wp-signup if site exists?
- Redirect to https not working with .htaccess [closed]
- How to do 301 redirect to Sub page using htaccess file?
- Rewrite WordPress Custom URL
- How to proxy local WP uploads folder to live site
- Using WP rather than .htaccess to redirect pages/posts
- htaccess redirect – directory and subpages to a single page
- WWW to non WWW redirect effects on load speed
- Can WordPress redirect to a “similar page” in case of 404 error
- htaccess redirect dynamic posts
- Hacked website redirect, only on desktop, help with restoring it [closed]
- RedirectMatch and Redirect interfering with each other
- .htaccess – Redirect duplicated post ended in ‘-number/’ to the same url without the -number/
- Custom rewrite rule
- Sub-subdomain getting redirected to main domain
- How to hide that a certain non-WordPress directory exists on the server?
- WordPress redirection problem after moving to a new server?
- Menu links only using http after enabling https, unable to redirect http links
- Redirect “any page/page/number/” to “any page”
- Why specific file directory fails to redirect but its parent folder succeeds?
- WordPress site in subdirectory load site in main directory
- https multiple redirects
- Specific URL Rewriting with parameters in wordpress
- How to create a 301 redirect that doesn’t apply to subsites
- How to exclude a directory from WordPress permalinks in a Multisite environment?
- Why does multisite bypass WordPress for wp-content, wp-admin, wp-includes and .php files?
- Alias ‘wp-content’ directory to something shorter (framework?)
- WordPress multisite htaccess redirection to new domain
- some url does not redirect from http to https
- Why can’t I access files / directories outside of wordpress
- WordPress blocking/preventing viewing of .cgi file in subdirectory [closed]
- Redirect blogpage /blog/abcd/ to /blog/
- https redirect (with .htaccess) redirect loop
- How to redirect from various ?page_id= to home page?
- How to set up htaccess to redirect a particular post type or subdirectory to HTTPS?
- Redirect Loop to Page, Can’t Find Origin, Can’t Remove [closed]
- Deny access to a path (give 403 or 404 response)
- htaccess 301 redirect http to https doesn’t work
- Redirect home to another page with htaccess
- Redirect all pages except one to homepage via .htaccess
- 301 Redirect Loop
- Redirect 301 www.my-site.com/page/n to www.my-site.com/ [closed]
- 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
- Headless WordPress redirect front-page to login page [closed]
- How to redirect subcategories to a page?
- Use htaccess to redirect WordPress to static website in a subfolder