Created
December 4, 2020 17:13
-
-
Save mndambuki/b8125fc8ee01529305bbaa73c43998ee to your computer and use it in GitHub Desktop.
HTACCESS, htaccess, rewrite rules, php, codeigniter: HTACCESS rewrite rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ============================================================================== START HTACCESS VARIATIONS | |
#Options +FollowSymLinks | |
#Options -Indexes | |
#DirectoryIndex index.php | |
#RewriteEngine on | |
#RewriteCond $1 !^(index.php|robots.txt|file|favicon.ico) | |
#RewriteCond %{REQUEST_FILENAME} !-d | |
#RewriteCond %{REQUEST_FILENAME} !-f | |
#RewriteRule ^(.*)$ index.php/$1 [L,QSA] | |
#RewriteCond %{SERVER_PORT} 80 | |
#RewriteCond $1 ^(tickets/login_register|login) | |
#RewriteRule ^(.*)$ https://www.pgproudsponsorofmums.co.uk/$1 [R=301,L] | |
#RewriteCond %{SERVER_PORT} 443 | |
#RewriteCond $1 !^(index.php|file|robots.txt|favicon.ico) | |
#RewriteRule ^(.*)$ http://www.pgproudsponsorofmums.co.uk/$1 [R=301,L] | |
# ============================================================================== ENDS HTACCESS VARIATIONS | |
# ============================================================================== PSOM HTACCESS THAT IS CURRENTLY IN USE | |
RewriteEngine on | |
RewriteCond $1 !^(index.php|file|robots.txt|favicon.ico|__utm.gif|urchin.js) | |
RewriteRule ^(.*)$ /index.php/$1 [L] | |
# ============================================================================== HAPPY BABY HTACCESS THAT IS CURRENTLY IN USE | |
RewriteEngine on | |
RewriteCond $1 !^(index.php|assets|robots.txt|favicon.ico) | |
RewriteRule ^(.*)$ index.php/$1 [L] | |
# ============================================================================== HTACCESS ALLOW FILE UPLOAD SETTINGS | |
AddType video/mpeg mpeg mpg mpe | |
AddType video/quicktime mpeg mpg mpe mp4 qt mov | |
AddType video/mp4 mp4 | |
AddType video/avi avi | |
AddType video/x-msvideo avi | |
php_value session.gc_maxlifetime 10800 | |
php_value max_input_time 10800 | |
php_value max_execution_time 10800 | |
php_value upload_max_filesize 110M | |
php_value post_max_size 120M | |
# ============================================================================== ASP.NET HTACCESS EQUIVALENT (file name should be 'web.config') | |
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rewriteMaps> | |
<rewriteMap name="(.*)" /> | |
</rewriteMaps> | |
<rules> | |
<rule name="codeigniterRuleOne" stopProcessing="true"> | |
<match url="(index.php|robots.txt|images|test.php|assets|file|favicon.ico|__utm.gif|urchin.js)" /> | |
</rule> | |
<rule name="codeigniterRuleTwo" stopProcessing="false"> | |
<match url=".*" /> | |
<action type="Rewrite" url="index.php/{r:0}" appendQueryString="false" /> | |
</rule> | |
</rules> | |
</rewrite> | |
</system.webServer> | |
</configuration> | |
# ============================================================================== EXAMPLE APACHE REWRITE RULES | |
<Location /folder1/folder2/folder3> | |
RewriteEngine On | |
RewriteBase /folder1/folder2/folder3 | |
#Removes access to the system folder by users. | |
#Additionally this will allow you to create a System.php controller, | |
#previously this would not have been possible. | |
#'system' can be replaced if you have renamed your system folder. | |
RewriteCond %{REQUEST_URI} ^system.* | |
RewriteRule ^(.*)$ /index.php?/$1 [L] | |
#When your application folder isn't in the system folder | |
#This snippet prevents user access to the application folder | |
#Submitted by: Fabdrol | |
#Rename 'application' to your applications folder name. | |
RewriteCond %{REQUEST_URI} ^application.* | |
RewriteRule ^(.*)$ /index.php?/$1 [L] | |
#Checks to see if the user is attempting to access a valid file, | |
#such as an image or css document, if this isn't true it sends the | |
#request to index.php | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*)$ index.php?/$1 [L] </Location> # /Ticket #74894 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment