Thanks for your replies. I have already solved my problem. Suppose I have my pages under http://www.yoursite.com/html, the following .htaccess rules apply.
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /html/(.*).html\ HTTP/ RewriteRule .* http://localhost/html/%1 [R=301,L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /html/(.*)\ HTTP/ RewriteRule .* %1.html [L] </IfModule>
Related Posts:
- How to remove .html from URL?
- .htaccess Remove WWW from URL + Directories
- Generic htaccess redirect www to non-www
- How can I use an .htaccess file in Nginx?
- Change PHP version on server using either .htaccess or php.ini
- Access-Control-Allow-Origin Multiple Origin Domains?
- htaccess – Redirect to subfolder without changing browser URL
- wordpress image upload error and htaccess rule explanation
- CodeIgniter removing index.php from url
- .htaccess deny from all
- Server unable to read htaccess file, denying access to be safe
- Getting a 500 Internal Server Error on Laravel 5+ Ubuntu 14.04
- Redirect non-www to www in .htaccess
- Using Errordocument 401 leads to blank page
- Masking wp-content/themes/name/images to just images directory using htaccess
- WordPress on a subdirectory of Laravel – WordPress pretty permalinks inner page shows laravel
- Place static HTML files in path below WordPress page
- htaccess rewrite for author query string when WP is in subfolder
- How to map permalinks with accented letters to sanitized slugs?
- Bypass .htaccess when using download_url
- Removing rules from .htaccess
- .htaccess rewrite rule for removing .php extension with exception of wp login and wp-admin
- Rewrite rule not working
- Cache Busting using htaccess Rewrite rule?
- WordPress multisite causing Error 101 (net::ERR_CONNECTION_RESET): Unknown error [duplicate]
- .htaccess redirects disappeared after re-saving permalinks
- Remove File Extension for Page Outside of WordPress
- WordPress URL/Folder ReWrite using Htaccess
- WordPress mod_rewrite is canceling/overwriting my other mod_rewrite rule
- How to rewrite WordPress uploads folder to another folder using htaccess
- How to protect media directory with .htaccess?
- How to create a 301 redirect that doesn’t apply to subsites
- Why does multisite bypass WordPress for wp-content, wp-admin, wp-includes and .php files?
- Remove base slug in permalinks of hierarchical custom post type
- WordPress rewrite rules don’t need ^?
- Why is my mod_rewrite not working?
- How can i redirect one url to another url using .htaccess or add_rewrite_rule
- Override htacces rule only for specific directory
- Adding rewrite rules directly to .htaccess file
- .htaccess rule to redirect old URLs to new structure [closed]
- Add additional non-rewrite .htaccess directives on multisites via mod_rewrite_rules filter
- Only default permalink is working mod_rewrite enabled
- mod_rewrite loop, redirecting http to https on certain section of wordpress blog
- a one-off rewrite rule
- blocking access to all post/tag URIs via htaccess
- Change htaccess to redirect to index.php in subfolder
- .htaccess rules for blocking bots with an extra condition
- Wrong Redirect/Rewrite Rules?
- Redirections and rewrites to subdomain
- How to change redirection route to a php page for making it only accessible by logged-in members?
- htaccess, site and staging in subdirectories
- How can I fix the redirect chain after implementing ssl on wordpress?
- How to write .htaccess so that https is on for subpages only but not the home page
- Rewriting “pretty” blog category URL with htaccess / add_rewrite_rule() causes 404 page
- How To Fix A Redirect Chain
- How to create a redirect in the .htaccess file, with 2 exceptions
- 404 error Additionally 403 Forbidden error on a URL
- Map secondary domain to other’s virtual subfolder
- Mod_Rewrite to show only last subcategory in URL
- Custom rewrite rule, url returning 404
- How to remove the [L] Flag for WordPress index .php mod_rewrite
- Loading index.php contents which located outside blog folder for post single page
- mod_rewrite doesn’t work as I want even with JSON API Plugin disabled
- I have a page using a pretty url and a mod_rewrite rule matching it. I expected it to give an error but it’s working. Why?
- Redirect – remove custom query string
- mod-rewrite exception? keep #hash in matching urls?
- I used single quote to design HTML of my WordPress blog. Now site redirects to index.php everytime than page.php or single.php
- .htaccess rewriterule being ignored – tyring to remove dates from WP posts
- disable WordPress 404 for one specific page/folder to receive actual php errors
- .htaccess Non-‘www’ to ‘www’ Subdomain Redirection Only Works for Homepage
- WordPress and Htaccess
- force www rewrite if wordpress put in a folder
- Deny access to uploads folder with exceptions
- WordPress Page Not Found if Permalink Settings is Postname
- Simple seo-friendly custom $_GET url rewrite with htaccess
- How do I make WordPress revise an .htaccess file a certain way?
- mod-rewrite rules grabs “broken permalinks”, too
- Rewriting subfolders to specific parent folder in WordPress
- Understanding Redirects
- Redirect WordPress site to a landing (construction) page using htaccess, with access to /wp-admin and /invoice
- htaccess redirect to path
- Can I add a rewrite rule in htaccess to remove the multisite subdirectory from the URL?
- Pretty URL via Rewrite
- URL Rewrite 404
- htaccess question and plugins.php
- Cannot get 301 redirection in htaccess to work (either Redirect or Rewrite)
- htaccess and redirect to new url using regex
- I can access subdirectory, but not files within it
- Pretty permalinks (again)
- ModRewrite not working properly
- Redirect homepage /page/1/ to /blog/page/1/
- htaccess mod_rewrite not working
- customize urls displayed by previous_post_link and next_post_link
- .htaccess not working in WordPress
- Add-on domain works in WordPress but links still lead to subdomain
- WordPress on a subfolder but accessible from root
- Can’t get pretty permalinks to work without index.php
- How to redirect a virtual page (e.g. /blog) to the home page?
- How can I stop WordPress from catching URL’s for static pages that I save on my server
- Add rewrite endpoint and .htaccess