Mobile app version of vmapp.org
Login or Join
Pierce454

: Need to redirect all files/folders under subfolder but leave subfolder alone I hope my title makes sense. Here is what I have: On our previous website, we had URLs similar to the following:

@Pierce454

Posted in: #301Redirect #Htaccess

I hope my title makes sense. Here is what I have: On our previous website, we had URLs similar to the following:
example.com/support/BIOS/JXT/0ABWDA22.zip
This same file on our new site has the structure:
example.com/wp-content/uploads/support/BIOS/JXT/0ABWDA22.zip
However our new site also has a page located at:
example.com/support
so I cannot use something like ^/support/(.*) as it rewrites and breaks the main support page. I am looking for any suggestions. I thought that perhaps the easiest way to handle this would be to ONLY rewrite urls where there is a file extension present? I have been googling for this very thing but haven't really stumbled across a solution as of yet.

Thanks

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Pierce454

2 Comments

Sorted by latest first Latest Oldest Best

 

@Angela700

Looks like you are looking for file-extension based redirects:

RewriteRule ^/(.*.(zip|jpg|png))$ /wp-content/uploads/ [L]


not sure of the correct syntax with folders, but in theory this should work...

10% popularity Vote Up Vote Down


 

@Merenda212

how is actual rule for example.com/support ?
i would suggest to create a rule that only apply to that URL [and redirects to the very same page], add a [L] command flag and THEN insert the ^/support/(.*) statement

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme