Skip to content

Instantly share code, notes, and snippets.

@Mao8a
Last active May 1, 2020 05:30
Show Gist options
  • Save Mao8a/5926641 to your computer and use it in GitHub Desktop.
Save Mao8a/5926641 to your computer and use it in GitHub Desktop.
HTACCESS: fixes
# remove "www"
RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
# Redirect to the Joomla root folder
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteRule ^(index\.html)?$ http://domain.com/subfolder/ [R=301]
# Only apply to URLs on this domain
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$
# Only apply to URLs that aren't already under folder
RewriteCond %{REQUEST_URI} !^/subfolder/
# Don't apply to URLs that go to existing files or folders
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all those to insert /subfolder
RewriteRule ^(.*)$ /subfolder/$1 [L]
##Use php 5.3 verison WebHostingBuzz
AddHandler application/x-httpd-php53 .php
# Giving WordPress Its Own Directory
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/my_subdir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /my_subdir/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ my_subdir/index.php [L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment