Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have a static HTML website with less than 100 pages and 99 of them are indexed in Google's search engine. I want to convert it into a WordPress website, but there are some problems I'm worried about.

My HTML website pages have an .html extension at the end of them and they're indexed with that extension, so converting those pages (even with the same content) to a WordPress page without any extension causes my whole website to be removed from Google's search.

I'm going to need to make sure that the .html extension is removed from URLs that already have just an .html extension. I want to do this using a .htaccess file. I found the following code, but it doesn't work:

^(([^/]+/)*[^/.]+)\.html?$
share|improve this question
    
See this related question: webmasters.stackexchange.com/questions/67358/… –  dan Jul 23 at 2:29

2 Answers 2

up vote 1 down vote accepted

Since I helped you with the htaccess file yesterday, I need to offer some advice here:

  1. Do not use Jaun's rule as a workaround.
  2. Leave both sites up, so the HTML based site stays indexed while you work on the WordPress Conversion.
  3. Sign Up for Google Webmaster Tools, and add both sites to your sitelist.
  4. Finish the WordPress Conversion, and remove the HTML site using the account you created in step 3.
  5. Create a Sitemap of the new WordPress site, and submit it to Google for Re-Indexing.
  6. Leave the permanent redirect from yesterday and the Permalink Rewrite Rules to force all your old visitors to your new site without creating Apache overkill.
share|improve this answer
    
yes i did that but i don't want the wordpress install get indexed so added that directory to robots.txt and i'm gonna redirect those URLs to the new ones from wordpress. but that redirect rule you provided doesn't work anymore but when i try to redirect using cpanel redirect, it is successfully redirected but the cpanel does this using rewrite rules. i don't know if it's good or not. –  Saeed em Jul 24 at 7:34
    
i gotta say that my domain is already using wild card redirect to redirect non-www version to www as it's the preferred domain in google webmaster –  Saeed em Jul 24 at 7:35
    
However you get the task completed is the important part. I believe the rule I gave you won't work if you forgot to include the Pretty Permalinks section. –  eyoung100 Jul 24 at 14:01
    
the Permalinks are set to post name. is that what you mean? and i needed to redirect every webpage to its wordpress version not to redirect all pages to index.php. wouldn't have google lost the track of my pages if i'd redirected all pages to index.php? –  Saeed em Jul 24 at 14:23
    
See the Do It Before Posting Section Here Without Permalinks, all pages get redirected to index.php?post_id –  eyoung100 Jul 24 at 14:30

I believe the problem is with your regular expression

This sould work fine:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]
share|improve this answer
    
so if i add it to the htaccess file which is in root folder it will add .html to all pages, But i have 2 wordpress websites in subfolders that don't want their addresses and pages change by this rule. can i still use it? –  Saeed em Jul 22 at 8:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.