I have been trying to redirect my webpage from http://35.176.138.35/CSGO/ to http://www.csgoskins.es using .htaccess and don't know what I've done that I destroyed my page, you can see that by entering at my page, that is the URL, I don't know how I generated:
http://csgoskins.es/www/NOMHOME/es/c/s/g/csgoskins/www/htdocs/public/www.csgoskins.eswww/NOMHOME/es/c/s/g/csgoskins/www/htdocs/public/www.csgoskins.eswww/NOMHOME/es/c/s/g/csgoskins/www/htdocs/public/www.csgoskins.eswww/NOMHOME/es/c/s/g/csgoskins/www/htdocs/public/www.csgoskins.eswww/NOMHOME/es/c/s/g/csgoskins/www/htdocs/public/www.csgoskins.eswww/NOMHOME/es/c/s/g/csgoskins/www/htdocs/public/www.csgoskins.eswww/NOMHOME/es/c/s/g/csgoskins/www/htdocs/public/www.csgoskins.eswww/NOMHOME/es/c/s/g/csgoskins/www/htdocs/public/www.csgoskins.eswww/NOMHOME/es/c/s/g/csgoskins/www/htdocs/public/www.csgoskins.eswww/NOMHOME/es/c/s/g/csgoskins/www/htdocs/public/www.csgoskins.eswww/NOMHOME/es/c/s/g/csgoskins/www/htdocs/public/www.csgoskins.eswww/NOMHOME/es/c/s/g/csgoskins/www/htdocs/public/www.csgoskins.eswww/NOMHOME/es/c/s/g/csgoskins/www/htdocs/public/www.csgoskins.eswww/NOMHOME/es/c/s/g/csgoskins/www/htdocs/public/www.csgoskins.eswww/NOMHOME/es/c/s/g/csgoskins/www/htdocs/public/www.csgoskins.eswww/NOMHOME/es/c/s/g/csgoskins/www/htdocs/public/www.csgoskins.eswww/NOMHOME/es/c/s/g/csgoskins/www/htdocs/public/www.csgoskins.eswww/NOMHOME/es/c/s/g/csgoskins/www/htdocs/public/www.csgoskins.eswww/NOMHOME/es/c/s/g/csgoskins/www/htdocs/public/www.csgoskins.es
Solution: make a forced refresh of the page.
Try this:
RewriteCond %{HTTP_HOST} ^35\.176\.138\.35$
RewriteCond %{REQUEST_URI} ^/CSGO
RewriteRule ^(.*)$ http://csgoskins.es [R=301]
Related
I would like to redirect all pages of my website to the same page, but with a get parameter attached.
What I've got so far:
#Check if Page already has parameter
RewriteCond !%{QUERY_STRING} (^|&)w=[0-9]+(&|$)
RewriteRule ^(.*)$ ......
I dont know how I can redirect to the same page again with the parameter attached.
You are not using the correct RewriteCond. If you want to redirect /filename.php to /filename.php?q=filename you can use this
RewriteEngine on
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^filename.php$ /filename.php?q=foobar [R,L]
I moved from a wordpress to a typo3 site. On my old sites, the links looked like this:
http://www.example.org/?page_id=44
now I want to redirect it to:
http://www.example.org/contact
Usually the redirects-rules are no problem, but this time I don't get it why it is not working:
I tried this:
Redirect 301 /?page_id=44 http://www.example.org/contact
as well as this:
RewriteRule http://www.example.org/\?page_id=44 http://www.example.org/contact [R=301,L]
and this here:
RewriteCond %{REQUEST_URI} ^example.org/\?page_id=44
RewriteRule ^(.*)$ http://www.example.org/contact [R=301,L]
Tried it in several browsers and incognito-mode, but it still remains wrong, it still adds the parameter instead of redirecting to the certain page.
I guess it is somehow doable with %{query_STRING} ?
Is it due to the param-thingy?
Any ideas how to solve this problem?
Okay, got it. It had something to do with the query string:
Final result:
RewriteCond %{QUERY_STRING} ^page_id=14$ [NC]
RewriteRule ^(index\.php){0,1}$ /kontakt/? [L,R=301,NC]
You can use:
RewriteCond %{THE_REQUEST} /\?page_id=44\s [NC]
RewriteRule ^/?$ /contact? [R=301,L]
Currently here's my htaccess code:
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{query_string} (^|&)p=contact$
RewriteRule (.*) /contact/
RewriteCond %{query_string} ^body=
RewriteRule (.*) $1? [R=301,L]
So what the code does is during the HTML query in URL, any queries that has "p=contact" will be redirected to the contact page. While any query that has the word 'body' will be removed.
Now the code works brilliantly if I visit my site (e.g: example.com).
However, if I try to type www.example.com, it will load as www.www.example.com. It has double wwws. Is there a fix for this?
Okay, I manage to solve it.
After hours of meddling with it, I realize if I change %{HTTP_HOST}% to my domain name it kinda makes it work perfectly.
Strange.
I have a website (WordPress multisite) for which I've moved a bunch of content from the route domain (http://domain[dot]com) to a sub domain (http://sub.domain[dot]com). Now I need to direct users to all the pages of the route site (http://domain[dot]com/page) to their new location (http://sub.domain[dot]com/page). But... and here's the bit I'm really struggling with... I need to omit the route url from this re-write as there is another 'geo-redirect' in place that I need to not affect. What I need to do therefore is redirect ONLY those sub page and NOT the parent/main domain.
Here's (a recent iteration) of what I'm working with:
# ignore the home page, not working :(
RewriteCond %{HTTP_HOST} !^(.*)\.routetogreatness\.com$ [NC]
# redirect all the sub pages, works
RewriteCond %{HTTP_HOST} ^routetogreatness.com [NC]
RewriteRule ^(.*)$ http://global.routetogreatness.com/$1 [L,R=301]
Any help will be very gratefully received.
I think what you are searching for is a condition that checks if the file that is requested is not a filename. That's what RewriteCond %{REQUEST_FILENAME} !-f. It is true if %{REQUEST_FILENAME} (I believe an absolute path to a file on the server, based on the request), is not a file. (Please note: I haven't tested this code as I don't have access to a server at this location, but I think it should work.)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://sub.domain.com/$1 [L,R=301]
An other solution would be to only rewrite the url if the requested url contains a slash. It would redirect domain.com/folder/index.php, but not domain.com/index.php.
RewriteCond %{REQUEST_URI} ^/([^/]+)/(.+)$
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://sub.domain.com/$1 [L,R=301]
Okay, so the above solution didn't quite work out for me as it turned out that while this worked beautifully on sub/child page, it would skip over parent pages as well as the home page (like domain/news for example. I've eventually run with this:
RewriteCond %{REQUEST_URI} !^/$
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://sub.domain.com/$1 [L,R=301]
This just skips over the home page or root URL and redirects everything else, even 404s.
I'm in the process of setting up a static cookieless domain, and everything is working great!
But im wanting to know how to redirect if the request isn't to an image/js/css file, to avoid duplicate content from the cookieless domain.
I have this:
RewriteCond %{HTTP_REFERER} ^http://files\.my-static-site\.com/ [NC]
RewriteRule \.(html|php)$ - [F,NC,L]
and it works, but it still loads the home page if you simply put files.my-static-site.com.
If you click on a link on the page your shown a 403. How do i change that to 301 redirect to the main domain instead of showing a 403?
Try changing it to this:
RewriteCond %{HTTP_HOST} ^files\.my-static-site\.com$ [NC]
RewriteRule \.(html|php)$ http://main.domain.com/ [R=301,NC,L]
RewriteCond %{HTTP_HOST} ^files\.my-static-site\.com$ [NC]
RewriteRule ^$ http://main.domain.com/ [R=301,NC,L]