How I can redirect page from https://url.pl?page=page to https://url.eu/page.html
I used on other page and this below works
<IfModule mod_rewrite.c>
Redirect 301 /page.html /newpage.html
</IfModule>
but when I used once below it doesn`t works
<IfModule mod_rewrite.c>
Redirect 301 /page.html /?page=page
</IfModule>
<IfModule mod_rewrite.c>
Redirect 301 https://www.domain.eu/page.html https://www.domain.eu/?page=page
</IfModule>
I also used RewriteRule but it also doesn`t works
htacess file
RewriteEngine on
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} https://www.maripol.pl/en/ [NC]
RewriteRule ^(.*)$ https://maripol.pl/en/$1 [L,R=301]
RewriteRule ^index.html$ https://maripol.pl/en [R=301,L]
RewriteRule ^index.php$ https://maripol.pl/en [R=301,L]
RewriteRule ^(.*),more.html$ index.php?page=more&id=$1 [NC,L]
RewriteRule ^(.*),pogodzinach.html$ index.php?page=pogodzinach&id=$1 [NC,L]
RewriteRule ^(.*),(.*).html$ index.php?page=oferta&id=$1&url=$2 [NC,L]
RewriteRule ^(.+)\.html$ ?page=$1 [NC,L]
RewriteCond %{THE_REQUEST} /en/\?page=informacje\s [NC]
RewriteRule ^en/?$ https://maripol.pl/en/informacje.html? [L,R,NE]
You can use RewriteRule
RewriteEngine on
#redirect /?page=page to /page.html
RewriteCond %{THE_REQUEST} /en/\?page=informacje\s [NC]
RewriteRule ^en/?$ https://maripol.pl/en/informacje.html? [L,R,NE]
Related
I tried the other solutions I found online but didn't workout.
My htaccess file looks like:
Options +FollowSymlinks
Options -Indexes
<FilesMatch "(?i)((\.tpl|\.ini|\.log))">
Order deny,allow
Deny from all
</FilesMatch>
RewriteEngine On
Redirect 301 ^abc https://www.example.com/abc-products
RewriteCond %{THE_REQUEST} \.html
RewriteRule ^(.*)\.html$ /$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteBase /
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
I was expecting example.com/abc url redirect to example.com/abc-products but it is redirecting to example.com/abc-products?_route_=abc
I also, tried the below ways
Redirect 301 ^abc https://www.example.com/abc-products
Redirect 301 ^/abc /abc-products
Redirect 301 /abc /abc-products
But the result is always https://www.example.com/abc-products?_route_=abc
Try after
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
add
RewriteRule ^abc/(.*)$ /abc-products/$1 [R=301,NC,L]
i thik you should try this code. 100% working.
Options +FollowSymlinks
Options -Indexes
<FilesMatch "(?i)((\.tpl|\.ini|\.log))">
Order deny,allow
Deny from all
</FilesMatch>
RewriteCond %{THE_REQUEST} \.html
RewriteRule ^(.*)\.html$ /$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteBase /
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
Redirect 301 / https://www.example.com/abc-products
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
If You have not working well. you let me know.
Thanks
I am trying to redirect the URL of webroot folder ie,
https://test.example.com/ to https://www.example.com/test
where test => webroot folder.
I have tried redirection in webroot/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
Redirect 301 /http://test.example.com http://example.com/test
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
also tried the following one :
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^https://test.example.com$ [NC]
RewriteRule ^(.*)$ https://www.example.com/test/ [R=301,L]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
Please help me to solve this..
Try with below,
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(.+)\.example.com
RewriteRule ^ https://www.example.com/%1%{REQUEST_URI} [L,R=301]
This will work:
<IfModule mod_rewrite.c>
RewriteEngine on
Redirect 301 / http://example.com/test/
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
Basically what I want to do is :
1) redirect any .html request to .php page.
2) if any 404 happens , then it should redirect to www.domain.com
3) domain.com should be redirected to www.domain.com
4) www.domain.com/index.html should redirect to www.domain.com
Here is my htaccess code
RewriteEngine On
RewriteRule ^(.*)\.html$ $1.php [L]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^fr/(.)*$ / [R=301,NC,L] # Added line
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . http://www.domsdain.com/index.php [L]
</IfModule>
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteRule ^(.*)index\.(php|html?)$ /$1 [R=301,NC,L]
With above code 4th rule (www.domain.com/index.html should redirect to www.domain.com) is not working
You can refactor to use these rules:
ErrorDocument 404 http://www.examle.com/
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} \s/+index\.(?:php|html) [NC]
RewriteRule ^ http://www.examle.com/ [L,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
RewriteRule ^(.+)\.html$ $1.php [L,NC]
RewriteRule ^fr/(.)*$ / [R=301,NC,L]
Make sure to clear your browser cache or use a new browser for testing.
I have switched from http to https, but now I am getting duplicate content. My .htaccess is:
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
I want to redirect homepage and all page/post to https. I have tried all methods, but no luck.
The page isn't redirecting properly. Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
No one worked.
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.rancahpost.com/$1 [R,L]
This:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
This:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R,L]
This
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.rancahpost.com/$1 [R=301,L]
This:
RewriteCond %{HTTPS} on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}/$1 [R=301,L]
This:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
This:
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
This:
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
How can I redirect all http traffic to https?
I transfered an old bulletin board to q2a.org. Now i have a lot index.php files in google which do as 200 OK Status. How can I redirect those links to root? ex. www.domain.com/index.php?page=Board&boardID=14 or www.domain.com/index.php?page=Thread&postID=58585
This is my current .htaccess file
ErrorDocument 404 /404.php
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
# Redirect non-www to www:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
</IfModule>
Thanks
Insert this rule just after RewriteBase line:
RewriteCond %{QUERY_STRING} page=[^&]+&postID=[^&]+ [NC]
RewriteRule ^ /? [R=301,L]