I need the sloution for home page 301 redirection.
If I enter http://www.starmed.dk/index.php in the browse bar, then it will be redirected to http://www.starmed.dk without index.php
Any idea how to do this with an HTACCESS 301 redirect?
Thanks in advance.
//Rewrite to www
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^starmed.dk[nc]
RewriteRule ^(.*)$ http://www.starmed.dk/$1 [r=301,nc]
//301 Redirect Old File
Redirect 301 www.starmed.dk/index.php www.starmed.dk
Edit:
Perhaps your configuration is different. perhaps this:
RewriteRule ^www.starmed.dk/index.php$ www.starmed.dk/ [R=301]
Try the following :
DirectoryIndexRedirect Off
RewriteEngine on
RewriteRule ^index\.php$ / [L,R]
Related
Here is my url:
http://localhost/BA/cookies-policy/register
I want that page to direct to :
http://localhost/BA/register
...and so on if the above link is accessed.
I am not familiar with htaccess.
Try this in .htaccess file in root directory:
RewriteEngine on
RewriteBase /
RewriteRule ^/BA/(.+)$ /$1 [L,QSA]
Basic .htaccess 301 redirect rule for one specific URL:
Redirect 301 /BA/cookies-policy/register http://localhost/BA/register
Rewrite rule to match your needs:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^BA/(.*)$ /$1 [R=301,L]
Try it like below, in your BA directory.
RewriteEngine On
RewriteRule ^cookies-policy/(.+?)$ /BA/$1 [R=301,L]
I have this url
www.example.com/nothing_here?registration=disabled
and I want to redirect it to
www.example.com/errors/418.php
I cannot get rid of the nothing_here part of the url. How to do this?
Thanks
In the htaccess file in your document root, add:
RedirectMatch 301 ^/nothing_here$ /errors/418.php?
or using mod_rewrite:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^registration=disabled$ [NC]
RewriteRule ^nothing_here$ /errors/418.php [L,R=301]
I have a big list of duplicate urls and i need to do some redirect
Example
www.mysite.com/mypage/name2_68.html
www.mysite.com/jjj/name2_68.html
www.mysite.com/aa/name2_68.html
www.mysite.com/5654/name2_68.html
www.mysite.com/mypage/myname87.html
www.mysite.com/6584/myname87.html
www.mysite.com/any-number/myname87.html
www.mysite.com/any_word/myname87.html
All i need to do is to redirect them to
www.mysite.com/mypage/myname87.html
www.mysite.com/mypage/name2_68.html
So all url with
www.mysite.com/anycharactere/example1.html
Will be redirect to
www.mysite.com/mypage/example1.html
This should work.
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^/mypage/?
RewriteRule ^[^/]+/(.*\.html?)$ /mypage/$1 [R=301,L]
Put it in your .htaccess
RewriteEngine On
RewriteRule .*/([^/]+.html)$ /mypage/$1
I'm really stuck with now so would appreciate any help.
I am trying to redirect a site to another domain but with some exceptions. Here is the code I have now in my .htaccess file
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !/sitemap/
RewriteCond %{REQUEST_URI} !/contact-us/
RewriteRule ^.*$ http://www.newsite.com/folder/$0 [R=301,L]
Redirect 301 /sitemap/ http://www.newsite.com/sitemap/
Redirect 301 /contact-us/ http://www.newsite.com/contact-us/
Any ideas why this may not be working?
The home page and the sitemap and contact us pages redirect fine but all other pages are not redirected.
Thanks in advance.
Move the Redirect lines higher
RewriteEngine On
Redirect 301 /sitemap/ http://www.newsite.com/sitemap/
Redirect 301 /contact-us/ http://www.newsite.com/contact-us/
RewriteBase /
RewriteCond %{REQUEST_URI} !/sitemap/
RewriteCond %{REQUEST_URI} !/contact-us/
RewriteRule ^.*$ http://www.newsite.com/folder/$0 [R=301,L]
I tried this on my apache server and it worked
http://www.oldsite.com/sitemap/ => http://www.newsite.com/sitemap/
http://www.oldsite.com/contact-us/ => http://www.newsite.com/contact-us/
http://www.oldsite.com/test => http://www.newsite.com/folder/test
I'm moving my site from old-domain.com to new-domain.com with exactly the same pages, e.g., if old-domain.com has a page1.html (i.e., old-domain.com/page1.html) then the new domain has the same page, i.e., new-domain.com/page1.html
I tried this in the .htaccess file:
RewriteEngine on
RewriteRule (.*) http://new-domain.com/$1 [R=301,L]
But only while old-domain.com will redirect to new-domain.com, old-domain.com/page1.html will not redirect to new-domain.com/page1.html
Thanks!
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !newdomain.com$ [NC]
RewriteRule ^(.*)$ http://newdomain.com/$1 [L,R=301]
See here for more solutions: http://enarion.net/web/htaccess/migrate-domains/
Try this in your htaccess
Redirect 301 / http://www.new.com/
This will redirect (and map) all your pages from http://old.com/page1 to http://new.com/page1
Try this:
RedirectPermanent / http://www.new-domain.com/