http://www.matthewsvolvosite.com/for...p?f=11&t=17479
Need to match and 301 redirect that. I've tried
RedirectMatch 301 ^/for\.\.\.p?f=11&t=17479$ /forums/viewtopic.php?t=17479
and
RedirectMatch 301 ^/for(.*)f=11&t=17479 /forums/viewtopic.php?f=2&t=17479
Neither work. I've searched and tried many examples. I'm at a loss.
The .htaccess file does match and redirect many other strings.
RewriteBase /
is active and working.
You need to use mod-rewrite
RewriteEngine on
RewriteCond %{QUERY_STRING} ^p=11&t=17479$
RewriteRule ^for\.\.\.p$ /forums/viewtopic.php?t=17479 [NC,L,R]
The reason why your redirect is not working is because you are using mod-alias to handle query strings .
Related
I want to redirect links containing characters like %C2%A0 on my htaccess file
example:
redirect 301 /actualite/presses-plieuses-electriques%C2%A0-les-5-criteres-de-choix_343.html https://www.mynewsite.com
is not working
redirect 301 /actualite/presses-plieuses-electriques-les-5-criteres-de-choix_343.html https://mynewsites.com
is working
How do I replace %C2%A0 and %E2%80%99 characters on mylinks ?
You can use this RewriteRule rule:
RewriteEngine On
RewriteRule ^actualite/presses-plieuses-electriques\xC2\xA0-les-5-criteres-de-choix_343\.html$ / [L,NC,R=301]
Note use of \xC2\xA0 for %C2%A0
I'm trying to redirect everything under www.mywebsite/asd/ except for three URLs and any subcontent, www.mywebsite/asd/A/, www.mywebsite/asd/B/ and www.mywebsite/asd/A/.
I tried the following pattern, but it seems to be faulty:
RedirectMatch 301 ^/asd/((?!A/|B/|C/).)* /asd/new-target/index.html
The regular expression does what I want, when I test it in a regex editor. But in htaccess it doesn't work. What do I have to change?
You can use this rule:
RedirectMatch 301 ^/asd/(?!A/|B/|C/|new-target/)(.*)$ /asd/new-target/index.html
And test it after clearing your browser cache. Make sure this is your first rule in site root .htaccess and there is no .htaccess in /asd/ directory.
Alternatively you can use this mod_rewrite rule in your site root .htaccess:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/ads/(?:A|B|C|new-target)/ [NC]
RewriteRule ^/?asd(?:/.*)?$ /asd/new-target/index.html [L,NC,R=301]
Suddenly GWT has reported over 50 404 errors for urls of this type
http://example.com/abc/&sa=U&ved=0CCYQFjADahUKEwi_lo-6nInHAhXIoZQKHfkXDZw&usg=AFQjCNEfkaKtU35GolQ-KLlTBjIuoMejlQ
I want to redirect these ugly and irrelevant urls to the actual URL i.e http://example.com/abc/
Will this code do the job
RedirectMatch ^/&sa$ /$1? [R=301,L]
or should i use query string for the same??
You can use this rule in your DOCUMENT_ROOT/.htaccess file:
RewriteEngine On
RewriteRule ^([^&]+)& /$1? [L,NE,R=302]
Any help with this would be great as I am struggling to get this to work.
I am trying to do a wildcard RedirectMatch 301 redirect for /pop.php?path=content/ using
RedirectMatch 301 /pop.php?path=content/.* http://mywebsite.com
But due to the ".", "?" and "=" is it not working correctly and I am not good with regular expressions.
Thanks
Steve
Put this in a .htaccess file in your site root:
RewriteEngine on
RewriteBase /
RewriteCond %{QUERY_STRING} path=content [NC]
RewriteRule pop.php http://mywebsite.com/? [R=301,L]
You need the RewriteCond to inspect the value of the query string. If and only if it's a match, pop.php will be redirected to the other site.
I need to have a redirect done to a site I have that is a 404 error.
Redirects are done in a .htaccess file for Joomla. This is what I have currently:
redirect 301 /?view=category&id=12:bestfriend&Itemid=946&start=20 http://www.mysite.com
But it doesn't redirect because it starts with a "?".
Any ideas? I have a number amount of these like this - not just one.
You cannot match query string using Redirect directive. Use mod_rewrite like this:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^view=category&id=12:bestfriend&Itemid=946&start=20 [NC]
RewriteRule ^ http://www.mysite.com/? [R=301,L]