I tried to search all pages but nothing to do for my request.
I need to REDIRECT the comlex link cause GOOGLE duplicate descriptions.
from:
http://www.3dstreaming.org/component/community/5816-stuart-edwards/profile.html?Itemid=0
to:
http://www.3dstreaming.org/you/edit-profile/5816-stuart-edwards.html
CONDICTIONS:
where "5816-stuart-edwards" is variable
part of the URL from "component/community" to "you/edit-profile"
replace from "5816-stuart-edwards/profile.html?Itemid=0" to "55816-stuart-edwards.html"
Many many thanks in advance.
Try the following:
RewriteEngine On
RewriteRule ^component/community/(.*)/profile.html$ /you/edit-profile/$1.html? [R]
RewriteRule ^you/edit-profile/(.*).html /component/community/$1/profile.html [L]
The above should change http://www.3dstreaming.org/component/community/5816-stuart-edwards/profile.html?Itemid=0 to: http://www.3dstreaming.org/you/edit-profile/5816-stuart-edwards.html
Related
I want to redirect all type of links like that :
www.sitename.com/link1-XXX.html
to
www.sitename.com/link1-XXX/
I don't want to redirect all .html links. I want to redirect all html links which end with XXX.
Solution :
RewriteRule ^(.*)XXX\.html$ /$XXX/ [R=301,L]
You did not specified the question, just told us what you want to do, not what is your problem...
if your problem is, that you dont know how to redirect only links like you described, then put this in your .htaccess with RewriteEngine on:
RewriteRule ^/(.*)-XXX\.html?$ /$1-XXX/ [L,QSA]
I did not really tested this regex..
It should take anything that end with /"something"-XXX.htm and /"something"-XXX.html and redirect it to subaddr named as "something"-XXX/
if you would need append some GET params to the processed url, you should change the regex so it ends like this:
...html?(.*)$
meaning, there can be anything after htm or html
This is how I would like to get my url to look at it any other way than before.
The problem is such that I must have forum and after forum content unique number that is in the database and after the url of the content.
I could imagine that it looked like this:
/forum/1/hello-world-stackoverflow-danmark/
now on my .htaccess file:
RewriteRule ^forum/([^/.]*)/([^/.]*)/?$ /forum-s.php?id=$1&url=$2 [L]
and now it:
www.hello-world.com/forum/velkommen-til-traenigsmakker---sjaelland/
I will have its to
www.hello-world.com/forum/1/velkommen-til-traenigsmakker---sjaelland/
Be sure to have RewriteEngine On
The code you have should work, you can optimize it like this to ensure the numbers.
RewriteRule ^forum/([0-9]+)/([^/.]*)/?$ /forum-s.php?id=$1&url=$2 [L]
In the past website was full of pages with different basis. After redisign and with new concept the website consists of only 1 page. So I need to redirect all old pages to /.
Pages for example:
http://domain.com/catalog/index.html?c_id=145
http://domain.com/catalog/?c_id=116
http://domain.com/news/read.html?id=174
and so on.
In htaccess I've made several rules like this:
RewriteRule ^catalog(.*)$ http://domain.com/ [L,R=301]
But this rule don't give a full control, and the result is not satisfactory:
http://domain.com/?c_id=145
How can I get rid of this? I need to redirect all such links to http://domain.com without any additions. I think the {QUERY_STRING} can help, but I don't know how to do this correct.
Any help would be appreciated. Thanks!
You can add a ? at the end to create a blank query string:
# append "?" here ----v
RewriteRule ^catalog(.*)$ http://domain.com/? [L,R=301]
Here is my problem...
I have a to redirect a link like this:
site.com/virtualfolder/some-seo-friendly-keywork
to
site.com/folder/page.php?id=some-seo-friendly-keyword
In site.com there is no real folder "virtualfolder", it is virtual.
I have to take "some-seo-friendly-keyword" and use it as a query string
I think i have to firts match the folder "virtualfolder" and then capture the "some-seo-friendly-keyword", but how?
The some-seo-friendly-keyword is a string of characters and digits plus hypens so something like this below is realistic?
RewriteRule ^virtualfolder/([a-zA-Z0-9-])? folder/page.php?id=$1 [L]
I'm still strudying and trying mod_rewrite and it is like voodoo to me! :-/
Thank you very much for your help or your suggestions
Try with this code in htaccess:
Using the original url to show:
Rewriterule ^virtualfolder/([a-zA-Z0-9_-]+)$ folder/page.php?id=$1
Redirecting to end url using RedirectMatch (use the full URL in the second part):
RedirectMatch 301 ^/virtualfolder/([a-zA-Z0-9_-]+)$ http://www.site.com/folder/page.php?id=$1
Redirecting to end url using mod_rewrite (use the full URL in the second part):
Rewriterule ^virtualfolder/([a-zA-Z0-9_-]+)$ http://www.site.com/folder/page.php?id=$1 [R=301,L,NE]
More info here
Hi I'm not a programmer by any stretch of the imagination and am trying to do a multi 301 redirect in my htaccess file based on the following:
So I have a ton of urls all with similar naming conventions - here is a sample of 2.
http://www.hollandsbrook.com/garrett-at-gold/
http://www.hollandsbrook.com/garrett-ace-250/
These urls need to redirect to:
http://www.hollandsbrook.com/garrett-metal-detectors/garrett-at-gold/
http://www.hollandsbrook.com/garrett-metal-detectors/garrett-ace-250/
I could just redirect them 1 line at a time, but I'd like to use regex.
Here's what I was thinking so far but not working:
RewriteRule ^garrett-([a-z])/$ /garrett-metal-detectors/$1/ [R]
Basically i need to redirect any page right off the root that starts with "garrett-" to include the folder path of "garrett-metal-detectors".
Any thoughts would be MUCH appreciated. Many thanks in advance for your help.
if you want temprorary redirect use:
RewriteRule ^garrett\-([a-z0-9\-]+)/?$ /garrett-metal-detectors/garrett-$1/ [R=302,L]
if you want permanent redirect use:
RewriteRule ^garrett\-([a-z0-9\-]+)/?$ /garrett-metal-detectors/garrett-$1/ [R=301,L]
I'm am not an expert on Regular Expressions, but looks like your reg ex may be a bit off...
try:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^((garrett)(-[a-z0-9]).*)/$ /metal-detectors/$1/ [R]
This is looking fro anything starting with "garrett" followed by any letter/number/hyphen combo.
Note: having "garett" in the destination part give you a loop of redirects, so you may have to choose a different word, or remove it all together...