Hey guys I need the htaccess code to do the following after moving domains.
From:
http://www.techau.tv/blog/review-d-link-2890al-wireless-modem-router/
To:
http://techau.com.au/review-d-link-2890al-wireless-modem-router/
So in the change of domain, I dropped the www and the /blog.
Try adding this to your .htaccess file on http://www.techau.tv :
## 301 Redirect Entire Directory
RedirectMatch 301 http://www.techau.tv/blog/(.*) http://techau.com.au/$1
RedirectMatch 301 http://techau.tv/blog/(.*) http://techau.com.au/$1
Seems to use a regex to do it.
I generated it with this tool by the way: http://www.htaccessredirect.com/
Related
We are rebuilding a website for a client from ASP to WordPress. This website will have a different domain, url structure, and file extension. I am only just getting my head around htaccess 301 redirects, and I know enough that I can't do the following:
Redirect 301 http://www.site1.com/about_us.asp https://site2.com/about/
Redirect 301 http://www.site1.com/art-specs/ https://site2.com/specs/
Redirect 301 http://www.site1.com/page/product1/ https://site2.com/product1/
There are about 12 links in total that need to be redirected, and I want to make sure that it is done right the first time as a client's SEO rankings are on the line.
Is there a variation of the above format that I could use? Or a rewrite rule that needs to be done first? Any help (and explanations) would be greatly appreciated!
After looking more into it, I realised that the htaccess file shouldn't need anything other than relative access to the original domain.
i.e. You shouldn't need to declare: http://www.site1.com/about_us.asp since the server and domain should be configured in such a way that /about_us.asp means the same thing.
So the correct answer would be to:
[1] Configure the server (in my case cPanel) by having the original domain added as an addon domain (e.g http://www.site1.com/).
[2] In the htaccess file I would add each of the 301 redirects to the htaccess file:
Redirect 301 /about_us.asp https://site2.com/about/
Redirect 301 /art-specs/ https://site2.com/specs/
Redirect 301 /page/product1/ https://site2.com/product1/
...for each redirect
[3] And finally, adding the following to the bottom of the htaccess file will catch everything else and redirect them to the home page:
RedirectMatch 301 .* https://site2.com
I am not able to find the error in the following Htaccess Code.
Isn't it just a simple 301 redirection?
Redirect 301 flaechenformeln.html http://www.mathespass.at/formeln/flaechenformeln.php
I have also tried to change the redirect a bit, but it is not working.
But however this works:
Redirect 301 /testversion/klasse2/index.html http://www.mathespass.at/testversion/klasse2/index.php
Isn't it the same?
Hope you can help me!
With best greetings
Redirect directive performs starting string match of the REQUEST_URI with the given pattern and it must start with a /.
Try this rule instead:
Redirect 301 /flaechenformeln.html http://www.mathespass.at/formeln/flaechenformeln.php
I need to redirect my old blog folder to my new blog folder but keep post-titles the name.
/oldblog/post-title to /newblog/post-title
I wrote:
RedirectMatch 301 /oldblog/(.*) /newblog/$1
This works until I bump into a url like /oldblog/events/
I want to exclude /oldblog/events/ from this rule. Thanks.
To exclude the oldblog/events , you can use :
RedirectMatch 301 ^/oldblog/((?!events).*)$ /newblog/$1
Clear your browser's cache before testing this code.
So I'm trying to rewrite the following example. Took a look around but couldn't find the correct post that matched this scenario.
Here is a list of layout for old pages:
www.url.com/directory
www.url.com/directory/page1.html
www.url.com/directory/page2.php
I'm trying to rewrite the following way through htaccess:
Redirect 301 /directory /newdirectory
Redirect 301 /directory/page1.html /newdirectory/page1
Redirect 301 /directory/page2.php /newdirectory/page2
However, the first rewrite rule is interfering with old subpages in that path. So for example, using the above rewrite rules, going to:
www.url.com/directory/page1.html
Points the user to:
www.url.com/newdirectory/page1.html
When it should be pointing user to the slug without the original filename extension:
www.url.com/newdirectory/page1
The only way around this that I've been able to manage is to leave out the www.url.com/newdirectory/page1.html rule entirely. But there are a bunch of links pointing to that base path, so I'd like to redirect that.
Any help would be greatly appreciated. Thanks in advance for the time and help.
url-rewriting redirect rewrite-rules
You need to place the rule for the base directory after the ones for the subpages :
Redirect 301 /directory/page1.html /newdirectory/page1
Redirect 301 /directory/page2.php /newdirectory/page2
Redirect 301 /directory /newdirectory
Before using word press for our new website we were using following urls...
http://www.domain.com/web-services
http://www.domain.com/seo-services (about 100 urls)
Now new url would be
http://www.domain.com/np/web-services
So we would like to 301 redirect all old pages to new pages, we could simple use following htaccess code...
Redirect 301 /web-services http://www.domain.com/np/web-services
But that would make htaccess file too large, so is there any way to redirect all pages to new pages.
thanks.
Enable mod_rewrite on your apache server, then put this inside your .htaccess file:
RewriteEngine On
RewriteRule ^/web-services/(.*)$ /np/web-services/$1 [R=301,L]
RewriteRule ^/seo-services/(.*)$ /np/web-services/$1 [R=301,L]
Any url starting with /web-services or /seo-services will be redirected to /np/web-services.
Or alternatively, you can use mod_alias' RedirectMatch:
RedirectMatch 301 ^/([^\-]+)-([^/]+)/?(.*)?$ /np/$1-$2/$3
So any request that starts with /web-services/ will get redirected with a /np appended to the front:
http://www.example.com/web-services/test1 -> http://www.example.com/np/web-services/test1
http://www.example.com/web-services/test/test2 -> http://www.example.com/np/web-services/test/test2
And the same with seo-services or anything with XXX-XXX.
EDIT:
if i try RedirectMatch 301 ^/([^\-]+)-([^/]+)-([^/]+) /np/$1-$2-$3/ its thorwing redirection error
Try:
RedirectMatch 301 ^/([^/\-]+)-([^/\-]+)-([^/]+) /np/$1-$2-$3/
Because /np/ is being matched against ^/([^\-]+)
You can rewite your domin like as if your domin was open with abc.com then you can permanently redirect it with www.abc.com. By doing this you can make sure that when google spider visit on your site then it can easily find your site. It also helps to increase more traffic on your site. If you have a busieness website then you can use SEO service from a company in Los Angeles going through reviews of best SEO Company in Chicago. Because these are helps to always push up your business growth towards top. Origin : http://www.bestseocompanyreviewss.com.