Skip to content

Instantly share code, notes, and snippets.

@xlimit91
Created April 23, 2019 17:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xlimit91/e960b7c2ba989736d74496121b2467c7 to your computer and use it in GitHub Desktop.
Save xlimit91/e960b7c2ba989736d74496121b2467c7 to your computer and use it in GitHub Desktop.
.htaccess replace a part of the url - redirect 301 wildcard
# Example:
# OLD URL: http://website.com/xxx/yyy/picture.png
# NEW URL: http://website.com/wp-content/picture.png
# So, I want to replace /xxx/yyy/ with the normal /wp-content/ path of WordPress.
# Put this in your .htaccess file.
RewriteEngine on
RedirectMatch 301 /xxx/yyy/(.*) http://website.com/wp-content/$1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment