I have wrote this rule in my htacces.. the rules redirect to correct url, but browser give me ERR_TOO_MANY_REDIRECTS error...
How can I correct my rule?
RewriteRule ^/?([^/]+)/?([^/]+)/172-cuccioli-allo-specchio/detail/(.*) https://www.allevamentochihuahua.com/foto-album-nostri-chihuahua/172-cuccioli-allo-specchio/detail/$3 [R=301,NC,L]
Try to use END flag because currently your rule is running over again because new url is again matching with our rule.
RewriteRule ^/?([^/]+)/?([^/]+)/172-cuccioli-allo-specchio/detail/([^/]+)$ https://www.allevamentochihuahua.com/foto-album-nostri-chihuahua/172-cuccioli-allo-specchio/detail/$3 [R=301,NC,L,END]
Reference:
https://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_end
Related
I have the following URL:
https://www.parcelparcel.com/nl_NL/pakket-versturen-frankrijk/?page=nl_NL/populair/pakket-naar-frankrijk/
Which I would like to 301 redirect to:
https://www.parcelparcel.com/nl_NL/pakket-versturen-frankrijk/
I tried to pull this off with the following code in my .htaccess:
RewriteRule ^index.php/populair/pakket-naar-frankrijk/?page=nl_NL/populair/pakket-naar-frankrijk/?$ https://www.parcelparcel.com/nl_NL/pakket-versturen-frankrijk/ [R=301,L]
However, without results. Can anybody advice me or tell me what I'm missing. I checked if the URL is redirected in incognito.
Thanks in advance!
Try This:
RewriteCond %{QUERY_STRING} !^(.*)$
RewriteRule ^nl_NL/pakket-versturen-frankrijk/?$ nl_NL/pakket-versturen-frankrijk/?page=nl_NL/populair/pakket-naar-frankrijk/ [L]
Fisrt line to exclude a request that has Query String
The second to choose a URI that starts with nl_NL/pakket-versturen-frankrijk/ or nl_NL/pakket-versturen-frankrijk and redirect it internally to nl_NL/pakket-versturen-frankrijk/?page=nl_NL/populair/pakket-naar-frankrijk/
Unfortunately I didn't get it solved by myself and need to ask for help. I want to redirect all urls which follow a certain pattern (in this case it contains "reviews/category"). These URLs supposed to be redirect to another url which is made up the first one:
http://[product-url]/reviews/category/[category-url]
supposed to be redirect to
http://[product-url].html
Furthermore it shouldn't matter if you call the url with or without www.
Example:
http://example.com/ford-blues/reviews/category/cars supposed to be redirect to http://example.com/ford-blues.html
Any help would be much appreciated.
Following code isn't working
RewriteEngine On
RewriteRule ^reviews/category/?$ $1\.html [R=301,L]
Try:
RedirectMatch 301 ^(.*)/reviews/category/ /$1.html
in the htaccess file in your document root.
Or using mod_rewrite:
RewriteEngine On
RewriteRule ^(.*)/reviews/category/ /$1.html [L,R=301]
I'm struggling to see why this rule won't work on the site.
The old url was /mobile/article/site/article-name and the new url is just /article/article-name
The rule is
RewriteRule ^mobile/article/tgc/(.*)$ /article/$1 [L,R=301]
Testing against http://htaccess.madewithlove.be/ with the whole htaccess file tells us
This rule was met, the new url is http://site.dev/article/article-name
Test are stopped, because of the R in your RewriteRule options. A redirect will be made with status code 301
but when we try hit http://site.dev/mobile/article/site/article-name in the browser, we get a 404 rather than a redirect.
What's even more curious is that we have the same kind of rule for another url
RewriteRule ^resources/a/(.*)$ http://resources.site.dev/library/$1 [L,R=301]
Which comes after our troubled redirect and it works just peachy.
What are we missing?
Keep your rule as this:
RewriteRule ^mobile/article/site/(.*)$ /article/$1 [L,NC,R=301]
I'm new to redirects and have researched how to do this but am just getting more and more confused.
What I'm wanting to do is create a rule to redirect:
From: http://www.example.com/wordpress/?p=1250
To: http://www.otherexample.com/blog
Where I'm running into issues is with the question mark. I've read somewhere that I'm not sure I'm doing this correctly, but here's what I have so far:
**Options +FollowSymlinks
RewriteEngine on
RewriteCond %{QUERY_STRING} ^p=1297$
RewriteRule ^wordpress$ linktoothersite [R=301, QSA, L, NC]**
I'm failing somewhere, any of you see what I'm doing wrong? Any help would be appreciated. I could only post two links, so link to other site would be the link.
If it's a single link you want to change you don't need a htaccess rule for that you can just do a redirect.
redirect 301 /wordpress/?p=250 http://www.othersite.com/blog
If the URL parameter changes you can use this rule.
RewriteEngine on
RewriteRule ^wordpress/(.*) http://www.othersite.com/blog [R=301,QSA,NC,L]
Note that when you use the QSA flag it will append the URL with the query parameter so if that's what you want the resulting URL will be.
http://www.othersite.com/blog?p=250
Otherwise if you remove the QSA flag, then it will just redirect to this
http://www.othersite.com/blog
How to do an htaccess redirection for the following
http://goozga.com/demo/index.php?option=com_content&view=article&id=70
needs to rewrite the above URL to
http://goozga.com/demo/index.php?option=com_content&view=article&id=73
please help me?
Try something like:
RewriteCond %{QUERY_STRING} option=com_content&view=article&id=70$
RewriteRule .* index.php?option=com_content&view=article&id=73 [L]
Note that your question has nothing to do with Joomla but depends on Apache's mod_rewrite instead.
Within Joomla, you can also use the Redirect component. You would just have to add a new redirect rule with the first URL as the source and the second as the destination URL.