Apologies I know there are loads of posts about mod-rewrite but I have been searching this forum and others for days to no avail. I have come back here as this forum has many helpful people and existing posts have helped with some answers. But everyone seems to have a slightly different scenario and I have exhausted my search.
Basically I would like to:
1. 301 redirect my .com domain to my .com.au domain. I own both domains and I want both to point to .com.au
2. remove www so the site would be [
domain.com.au...]
3. remove index.html from the end of my homepage URL
4. set up extensionless URLs - I only have .html at the moment and don't envisage changing that as its a fairly basic site.
The code I have so far is:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^/?$ "http\:\/\/domain\.com\.au\/" [R=301,L]
RewriteCond %{HTTP_HOST} ^www.domain.com.au$
RewriteRule ^/?$ "http\:\/\/domain\.com\.au" [R=301,L]
1. The rewrite .com to .com.au seems to be working fine.
2. Removing www works for the homepage, but if someone keys in www.domain.com.au/page1 the www remains. Can I get rid of all occurences of www and is it worthwhile?
3. I have looked around and I'm not sure how to remove index.html especially when combined with my other requirements
4. I have tried various bits of code from this site and can't get it to work. I'm not sure if its because of my .com.au domain?
My site is quite small and simple. I am willing to change the file organisation slightly if this is necessary. The structure at present is
homepage at domain.com.au
Then I have Page1, Page2 etc in the root folder appearing as domain.com.au/page1.html
Then I have folders for each page, containing subsidiary info for example
domain.com.au/page1/pageinfo3.html
domain.com.au/page3/pageinfo2.html
I thought this would be one of the most popular combinations of mod rewrites - essentially, I just want to tidy up the URLs for what is a simple html site. But I have had only partial success searching the forums.
Is anyone able to help?