Tag Archive for htaccess

Rediccionamiento Apache desde una IP determinada

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_HOST} !^80.38.0.115
RewriteRule (.*) <a href="http://www.territoriocreativo.es/$1" >http://www.territoriocreativo.es/$1</a> [R=301,L]
BEGIN WordPress

source

Codeigniter .htaccess

RewriteEngine on
RewriteBase /
# Hide the application and system directories by redirecting the request to index.php
RewriteRule ^(application|system|.svn) index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,L]

source

htaccess 301 redirect

Redirect 301 /old/old.html <a href="http://www.you.com/new.html

" >http://www.you.com/new.html
source

disable IE6 image toolbar with http header via htaccess

<FilesMatch ".(html|htm|php)$">
Header set imagetoolbar "no"
</FilesMatch>

source

.htacces – clean urls

# Follow symbolic links in this directory.
Options +FollowSymLinks

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?path=$1 [L,QSA]

</IfModule>

source

Parse HTML files as PHP

AddType application/x-httpd-php .html

source

Redirect A Single Page To HTTPS Using mod_rewrite

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^example.com [nc]
rewriterule ^(.*)$ <a href="http://www.example.com/$1" >http://www.example.com/$1</a> [r=301,nc]

rewritecond %{SERVER_PORT} !^443$
rewriterule ^filename.php(.*)$ <a href="https://www.example.com/filename.php$1" >https://www.example.com/filename.php$1</a> [r=301]

source

Replace _ with – in almost every url (plus nice tag urls in movabletype)

RewriteEngine On
RewriteRule ^tag/?$ /browse.html [L]
RewriteRule ^tag/(.*)$ /mt/mt-search.cgi?tag=$1&blog_id=1&IncludeBlogs=1 [L]
RewriteRule ^mt-static(.*)$ - [L]
RewriteRule ^(.*)_(.*)$ $1-$2 [N]

source

Forward from domain aliases to main domain

# forward from domain aliases
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?domain1.com [NC,OR]
RewriteCond %{HTTP_HOST} ^(www.)?domain2.com [NC,OR]
RewriteCond %{HTTP_HOST} ^(www.)?domain3.com [NC,OR]
RewriteCond %{HTTP_HOST} ^(www.)?and_so_on.com [NC]
RewriteRule (.*) <a href="http://maindomain.com/$1" >http://maindomain.com/$1</a> [R=301,L]
# END forward from domain aliases

source

Force removal of WWW in url

# force removal of www IN URL
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ <a href="http://example.com/$1" >http://example.com/$1</a> [R=301,L]
# END force removal of www IN URL# force www IN URL

source