New answers tagged

1 vote

Odd behavior of bash array

Took me a while to get back. If you don't declare it as an associative array then it's a numerically-indexed array for which the index part is treated as an arithmetic expression. In an arithmetic ...
0 votes
Accepted

Redirect all URLs ending in ".-detail" to remove the dot

RewriteRule ^$.-detail https://www.example.com/$1-detail [R=301,L] There are few issues with the regex: The $ (end-of-string anchor) is in the wrong place. This should be at the end of the regex (...
  • 12k
0 votes
Accepted

RegEx for 301 redirects to change path AND remove a string

You can try this: /components/com_mijoshop/opencart/image/cache/(?'path'.*)-365x365.jpg /wp-content/uploads/nc/[path].jpg
0 votes

Extract repository name from GitHub url in bash

A slight modification to @Hicham's answer ^(https|git)(:\/\/|@)([^\/:]+)[\/:]([^\/:]+)\/(.+?)(\.git)?$ Will extract out the .git suffix as well.

Top 50 recent answers are included