#RewriteEngine on
#RewriteRule ^index/([^/]+)/([^/]+).php /team-detail.php?team_id=$1&team_name=$2 [NC]
RewriteEngine on

# Follow symbolic links.
Options +FollowSymLinks

# Redirect to domain with www.
#RewriteCond %{HTTPS} off
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Same for HTTPS:
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.saiyedalimiradatardargah.com$
RewriteRule ^(.*)$ https://www.saiyedalimiradatardargah.com/$1 [R=301,L]

RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} ^saiyedalimiradatardargah.com$
RewriteRule (.*) https://www.saiyedalimiradatardargah.com/$1 [R=301,L]

# Stop hotlinking.
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} ^https?://([^/]+)/ [NC]
RewriteCond %1#%{HTTP_HOST} !^(.+)#\1$
RewriteRule \.(jpg|jpeg|png|gif|swf|svg)$ - [NC,F,L]

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^/?team-detail/(.*?)/?$ /team-detail.php?token=$1 [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /team-detail\.php\?token=([^\&\ ]+)
RewriteRule ^/?team-detail\.php$ team-detail/%1? [L,R=301]

RewriteRule ^/?event-detail/(.*?)/?$ /event-detail.php?token=$1 [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /event-detail\.php\?token=([^\&\ ]+)
RewriteRule ^/?event-detail\.php$ event-detail/%1? [L,R=301]

RewriteRule ^/?history/(.*?)/?$ /history.php?token=$1 [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /history\.php\?token=([^\&\ ]+)
RewriteRule ^/?history\.php$ history/%1? [L,R=301]

RewriteRule ^/?gallery/(.*?)/?$ /gallery.php?token=$1 [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /gallery\.php\?token=([^\&\ ]+)
RewriteRule ^/?gallery\.php$ gallery/%1? [L,R=301]

RewriteRule ^/?youtube/(.*?)/?$ /youtube.php?token=$1 [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /youtube\.php\?token=([^\&\ ]+)
RewriteRule ^/?youtube\.php$ youtube/%1? [L,R=301]

RewriteRule ^/?blog/(.*?)/?$ /blog.php?token=$1 [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /blog\.php\?token=([^\&\ ]+)
RewriteRule ^/?blog\.php$ blog/%1? [L,R=301]

# Custom error pages.
ErrorDocument 404 /saiyedalimiradatardargah.com/404.php

# Prevent directory listings
Options All -Indexes

# Compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)\.(gif|jpg|png|jpeg|css|js|swf)$ /public/$1.$2 [L,NC]

    # Removes index.php from ExpressionEngine URLs  
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php/$1 [L,QSA]

</IfModule>

<ifModule mod_gzip.c>
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
  mod_gzip_item_include handler ^cgi-script$
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_exclude mime ^image/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

<ifModule mod_expires.c>
  ExpiresActive On
  ExpiresDefault "access plus 1 seconds"
  ExpiresByType text/html "access plus 1 seconds"
  ExpiresByType image/gif "access plus 2592000 seconds"
  ExpiresByType image/jpeg "access plus 2592000 seconds"
  ExpiresByType image/png "access plus 2592000 seconds"
  ExpiresByType text/css "access plus 604800 seconds"
  ExpiresByType text/javascript "access plus 216000 seconds"
  ExpiresByType application/x-javascript "access plus 216000 seconds"
</ifModule>

# BEGIN cPanel-generated php ini directives, do not edit
# Manual editing of this file may result in unexpected behavior.
# To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
# For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
<IfModule php7_module>
   php_flag display_errors On
   php_value max_execution_time 30
   php_value max_input_time 60
   php_value max_input_vars 1000
   php_value memory_limit 128M
   php_value post_max_size 8M
   php_value session.gc_maxlifetime 1440
   php_value session.save_path "/var/cpanel/php/sessions/ea-php72"
   php_value upload_max_filesize 2M
   php_flag zlib.output_compression Off
</IfModule>
<IfModule lsapi_module>
   php_flag display_errors On
   php_value max_execution_time 30
   php_value max_input_time 60
   php_value max_input_vars 1000
   php_value memory_limit 128M
   php_value post_max_size 8M
   php_value session.gc_maxlifetime 1440
   php_value session.save_path "/var/cpanel/php/sessions/ea-php72"
   php_value upload_max_filesize 2M
   php_flag zlib.output_compression Off
</IfModule>
# END cPanel-generated php ini directives, do not edit

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php72” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php72 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
