Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to REGEX and .htaccess rewrite url
    primarykey
    data
    text
    <p>I have this url and I need to grab the tags and rewrite the url </p> <p><a href="http://beantownbride.com/darkroom/mt/mt-search.cgi?blog_id=1&amp;tag=Social%20Media&amp;limit=20&amp;IncludeBlogs=1" rel="nofollow">http://beantownbride.com/darkroom/mt/mt-search.cgi?blog_id=1&amp;tag=Social%20Media&amp;limit=20&amp;IncludeBlogs=1</a></p> <p>So, in the example above to something more like this <a href="http://beantownbride.com/?s=Social+Media" rel="nofollow">http://beantownbride.com/?s=Social+Media</a></p> <p>Here is what I have so far for my .htaccess file</p> <pre><code>RewriteRule ^http://beantownbride.com/darkroom/mt/mt-search.cgi?blog_id=(*.)&amp;tag=(*.) http://beantownbride.com/?s=$2 </code></pre> <p>but it only works for the first tag (if it works at all)</p> <p>the whole .htaccess file</p> <pre><code>RewriteEngine On # BEGIN WordPress #MT to WP # Convert old archives RewriteRule ^/archives/([0-9]*)\.php$ /$1/ [R=301,L] RewriteRule ^/archives/([0-9]*)\.html$ /$1/ [R=301,L] RewriteRule ^/archives/([0-9]*)\.shtml$ /$1/ [R=301,L] RewriteRule ^/archives/([0-9][0-9][0-9][0-9]/[0-9][0-9]/.*)\.php$ /$1/ [R=301,L] RewriteRule ^/archives/old/([0-9]*)\.php$ /$1/ [R=301,L] RewriteRule ^/archives/cat_(.+)\.php$ /category/$1/ [R=301,L] RewriteRule ^/archives/cat_(.+)\.html$ /category/$1/ [R=301,L] RewriteRule ^/archives/cat_(.+)\.shtml$ /category/$1/ [R=301,L] RewriteRule ^/archives/?$ /archive/ [R=301,L] RewriteCond %{REQUEST_URI} !^/archives/[0-9][0-9][0-9][0-9]/[0-9][0-9]/?.*$ [NC] RewriteCond %{REQUEST_URI} !^/archives/[0-9][0-9][0-9][0-9][0-9][0-9]\.?.*$ [NC] RewriteCond %{REQUEST_URI} !^/archives/tag/.*$ [NC] RewriteCond %{REQUEST_URI} !^/archives/author/.*$ [NC] RewriteRule ^/archives/(.*)$ /category/$1 [R=301,L] RewriteRule ^/archives/(.*)$ /$1 [R=301,L] # Change underscores hyphens RewriteRule ^/category/([^_]*)_([^_]*)_([^_]*)_(.*)$ /category/$1-$2-$3-$4/ [R=301,L] RewriteRule ^/category/([^_]*)_([^_]*)_(.*)$ /category/$1-$2-$3/ [R=301,L] RewriteRule ^/category/([^_]*)_(.*)$ /category/$1-$2/ [R=301,L] RewriteRule ^/([0-9][0-9][0-9][0-9]/[0-9][0-9])/([^_/]*)_([^_/]*)_([^_/]*)_(.*)/(.+)$ /$1/$2-$3-$4-$5/$6 [R=301,L] RewriteRule ^/([0-9][0-9][0-9][0-9]/[0-9][0-9])/([^_/]*)_([^_/]*)_(.*)/(.+)$ /$1/$2-$3-$4/$5 [R=301,L] RewriteRule ^/([0-9][0-9][0-9][0-9]/[0-9][0-9])/([^_/]*)_(.*)/(.+)$ /$1/$2-$3/$4 [R=301,L] # Change to wordpress feeds RewriteRule ^/atom$ /wp-atom.php [R=301,L] RewriteRule ^/atom\.xml$ /wp-atom.php [R=301,L] RewriteRule ^/index\.atom$ /wp-atom.php [R=301,L] RewriteRule ^/index\.rdf$ /wp-rdf.php [R=301,L] RewriteRule ^/index\.xml$ /wp-rss2.php [R=301,L] RewriteRule ^/rss\.xml$ /wp-rss.php [R=301,L] Redirect permanent /rss.xml /feed/ RewriteRule ^/([0-9][0-9][0-9][0-9]/[0-9][0-9]/.*)\.atom$ /$1/feed/ [R=301,L] RewriteRule ^/([0-9][0-9][0-9][0-9]/[0-9][0-9]/.*)\.atom/$ /$1/feed/ [R=301,L] RewriteRule ^/([0-9][0-9][0-9][0-9]/[0-9][0-9]/.*)\.xml$ /$1/feed/ [R=301,L] RewriteRule ^/([0-9][0-9][0-9][0-9]/[0-9][0-9]/.*)\.xml/$ /$1/feed/ [R=301,L] Redirect permanent /about.html /about Redirect permanent /advertise.html /advertise Redirect permanent /contact.html /contact Redirect permanent /welcome-about/ /about/ Redirect permanent /welcome-about/welcome-to-my-blog.html /about/ Redirect permanent /real-wedding /real-weddings RewriteRule ^/events/(.*)$ /?s=events #http://beantownbride.com/darkroom/mt/mt-search.cgi?blog_id=1&amp;tag=Social%20Media&amp;limit=20&amp;IncludeBlogs=1 #RewriteRule ^/darkroom/mt/mt-search.cgi?blog_id=1&amp;tag=(*.)&amp;limit #http://beantownbride.com/?s=test+tag+blah #RewriteRule ^http://beantownbride.com/darkroom/mt/mt-search.cgi?blog_id=(.*)&amp;tag=(.*)$ http://beantownbride.com/?s=$2 RewriteRule ^http://beantownbride.com/darkroom/mt/mt-search.cgi?blog_id=(.*)&amp;tag=(.*)$ http://beantownbride.com/?s=$2 &lt;IfModule mod_rewrite.c&gt; RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] &lt;/IfModule&gt; # END WordPress </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload