Forum Moderators: phranque
I've been far to fearful of breaking something to touch the httpd.conf file until now. I'd like to post my htaccess file in the hope someone will have the time to talk me through the migration, writing a step by step guide, what should be adjusted (and why) etc etc...
... As there are very few people that have as profound a knowledge of Apache as Jim, the moderator of the Apache forum, many of us, inclusing myself use a virtualhost control panel, in my case, cPanel, so when I do this, I'll talk about the results and try to list the issues I faced, such as the risk of losing the changes made upon a server restart, or Apache rebuild...
My htaccess is posted below... who'll help me?...
-----------------------------------------------
AddType application/x-httpd-php .html .xhtml
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName example.com
RewriteEngine on
# Externally redirect direct client requests for index.xyz to "/" in same directory, removing query string
RewriteCond %{HTTP_HOST}>%{THE_REQUEST} ^((www在eta好ewservice)\.example\.com)>[A-Z]+\ /(([^/]+/)*)index\.([xs]?html?如hp[456]?)(\?[^\ ]*)?\ HTTP/
RewriteCond %3 !^(forum她ea)/
RewriteRule /?index\.([xs]?html?如hp[456]?)$ [%1...] [R=301,L]
#
# Redirect to remove multiple consecutive slashes within URL-path
RewriteCond %{HTTP_HOST}>%{REQUEST_URI} ^((www在eta好ewservice)\.example\.com)>(.*)//+(.*)$
RewriteRule . [%1%3...] [R=301,L]
#
# Redirect to remove multiple consecutive slashes before URL-path
RewriteCond %{HTTP_HOST}>%{THE_REQUEST} ^((www在eta好ewservice)\.example\.com)>[A-Z]{3,9}\ //+([^\ ]*)
RewriteRule .* [%1...] [R=301,L]
#
# Externally redirect direct client requests for URLS with "page" file extensions
# to extensionless URLs
RewriteCond %{HTTP_HOST}>%{THE_REQUEST} ^((www在eta好ewservice)\.example\.com)>[A-Z]+\ /(([^/]+/)*[^./]+)\.([xs]?html?如hp[456]?)(\?[^\ ]*)?\ HTTP/
RewriteCond %3 !^(forum她ea)/
RewriteRule \.([xs]?html?如hp[456]?)$ [%1...] [R=301,L]
#
# Externally redirect requests for non-blank, non-canonical hostnames to canonical hostnames
#
# Canonicalize "newservice"
RewriteCond %{HTTP_HOST} newservice\.example\.com
RewriteCond %{HTTP_HOST} !^newservice\.example\.com$
RewriteRule ^(.*)$ [newservice.example.com...] [R=301,L]
#
# Canonicalize "beta"
RewriteCond %{HTTP_HOST} beta\.example\.com
RewriteCond %{HTTP_HOST} !^beta\.example\.com$
RewriteRule ^(.*)$ [beta.example.com...] [R=301,L]
#
# Canonicalize all others
RewriteCond %{HTTP_HOST} example\.com$ [NC]
RewriteCond %{HTTP_HOST} !^(www好ewservice在eta)\.example\.com$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
#
# Return 403-Forbidden response for included-object requests with non-blank off-site referrers
RewriteCond %{HTTP_REFERER} !^(https?://(www\.)?(beta\.)?(newservice\.)?example\.com(/.*)?)?$ [NC]
RewriteRule \.(jpe?g夙if在mp如ng夷co圭ss夸s)$ - [NC,F]
#
# Skip the following three rules if the requested URL-path has a file extension, if it is
# blank (i.e. a "homepage" request), or if it exists as a directory when a slash is appended
RewriteCond $1 \.[a-z0-9]+$回$ [NC,OR]
RewriteCond %{REQUEST_FILENAME}/ -d
RewriteRule (.*) - [S=3]
#
# Internally rewrite extensionless URL request to existing .html file
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule (.+) /$1.html [L]
#
# Internally rewrite extensionless URL request to existing .xhtml file
RewriteCond %{REQUEST_FILENAME}.xhtml -f
RewriteRule (.+) /$1.xhtml [L]
#
# Internally rewrite extensionless URL request to existing .php file
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule (.+) /$1.php [L]
ErrorDocument 404 /404.php