Table of Contents
HTACCESS
- File type: hidden ( dotted).
- Cached: no
- Location: website root + various directories.
- Permissions: 644
- Related to: core platform.
- Platform updates: do not erase primary .htaccess file ( starting from version 1.8.3).
- Related database tables: none
.htaccess files provide a way to make configuration of the Apache Web Server software to enable/disable additional functionality and features that the Apache Web Server software has to offer. Read Apache HTTP Server Tutorial: .htaccess files for more information about .htaccess and it's directives.
In SkaDate software .htaccess files contain directives required for the software to operate correctly and securely after installation. Primary .htaccess is mainly responsible for declaring required directives. Secondary .htaccess files are mainly responsible for managing directory access.
Default directives
Primary .htaccess file of SkaDate software:
Options +FollowSymLinks RewriteEngine On AddEncoding gzip .gz AddEncoding gzip .gzip <FilesMatch "\.(js.gz|js.gzip)$"> ForceType text/javascript </FilesMatch> <FilesMatch "\.(css.gz|css.gzip)$"> ForceType text/css </FilesMatch> RewriteCond %{REQUEST_URI} !^/index\.php RewriteCond %{REQUEST_URI} !/ow_updates/index\.php RewriteCond %{REQUEST_URI} !/ow_updates/ RewriteCond %{REQUEST_URI} !/ow_cron/run\.php RewriteCond %{REQUEST_URI} !/e500\.php RewriteCond %{REQUEST_URI} !/captcha\.php #RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.xml|\.feed|robots\.txt|\.raw|/[^.]*)$ [NC] RewriteCond %{REQUEST_FILENAME} (/|\.php|\.html|\.htm|\.xml|\.feed|robots\.txt|\.raw|/[^.]*)$ [NC] RewriteRule (.*) index.php
Secondary .htaccess file directives vary. Most common:
deny from all
/ow_userfiles/ direcory .htaccess:
Options All -Indexes <IfModule php5_module> php_flag engine off </IfModule>
Where to find .htaccess
Primary .htaccess file of SkaDate software is located in website's root directory. Same location is used to store other software related files such as ow_version.xml and index.php. Secondary .htaccess files are located within each folder of SkaDate software. Ex: ow_includes, ow_plugins.
.htaccess files can be opened from cPanel's File Manager or FTP client ( ex. FileZilla).
To open .htaccess from FTP client:
- Log in to your server via FTP.
- Navigate to your website's root directory to open primary .htaccess file. Navigate to desired directory to open secondary .htaccess files.
- Right mouse click over found file.
- Select view/edit/download from opened action menu.
To open .htaccess from File Manager:
- Log in to cPanel.
- Click the “File Manager” icon from “Files” section.
- Enable “Show Hidden Files”.
- Navigate to your website's root directory to open primary .htaccess file.Navigate to desired directory to open secondary .htaccess files.
- Right click on the mouse over found file.
- Select view/edit/download from opened action menu.
If you are not sure how to use FTP client or File Manager, please refer to hosting provider's documentation.
How to show hidden files in File Manager
Depending on your cPanel's interface check “Show hidden files” box:
- within pop up window that appears right after you click the “File Manager” icon.
- within pop up window that appears after you click “Settings” from upper right corner of already opened File Manager interface.
If you are not sure how to display hidden files within your cPanel, please refer to hosting provider's documentation.
Errors related to .htaccess
Common error code: 404 not found.
404 not found sitewide
- Accessibility: initial sitename.com page loads. Any other page results in 404 not found.
- Cause: missing or misconfigured primary .htaccess file.
- Case: 404 not found error for sitename.com/admin URL after software migration/updates/restore from back up.
- Solution:
- make sure that primary .htaccess file exists in your website's root directory. Please refer to “Where to find .htaccess” section of this manual. In case of missing .htaccess file create .htaccess manually via File Manager or FTP client. Include default directives of primary .htaccess file into your new .htaccess.
- make sure that primary .htaccess file contains required default directives. Please refer to “Default directives” section of this manual.
404 not found for external pages/directories
- Accessibility: all website pages load except custom external document/directory
- Cause: primary .htaccess file's rewrite rules block custom xternal documents/directories.
- Case: 404 not found error for www.sitename.com/sitemap.xml URL, where sitename.com is an external document that doesn't come with default SkaDate software.
- Solution: add rewrite condition for external custom page/directory. Please refer to “How to edit primary .htaccess” section of this manual.
404 not found for temporary site URL
- Accessibility: partially accessible.
- Cause: missing rewrite base for temporary URL.
- Case: 404 not found error when software is installed under temporary URL. Temporary URL format: http://server.ip/~cpanelusername/ .Ex: https://20.0220.202/~john
- Solution: add rewrite base for ~cpanelusername. Please refer to “How to edit primary .htaccess” section of this manual.
Note: Make sure that temporary URL is used in ow_includes/config.php file.
How to edit primary .htaccess ( examples)
Adding new rewrite base
New rewrite base can be added after following line: RewriteEngine On. Ex:
Options +FollowSymLinks RewriteEngine On RewriteBase /~cpanelusername AddEncoding gzip .gz AddEncoding gzip .gzip
Adding new rewrite condition
New rewrite conditions must be added after following line: RewriteCond %{REQUEST_URI} !^/index\.php .
For custom external documents: RewriteCond %{REQUEST_URI} !^/document_name\.document_extension. Ex:
RewriteCond %{REQUEST_URI} !^/sitemap\.xml RewriteCond %{REQUEST_URI} !^/landing-page\.html
For custom external directories: RewriteCond %{REQUEST_URI} !/directory-name/ . Ex:
RewriteCond %{REQUEST_URI} !/banners/
Adding PHP handlers
Handlers can be added at the end of the default .htaccess directives. Ex:
# Use PHP5.5 as default AddHandler application/x-httpd-php55 .php
Comments in .htaccess
To comment out ( hide) certain directive add # at the beginning of the line. Ex:
#RewriteCond %{REQUEST_URI} !/captcha\.php
.htaccess Tutorials
Rewrite Condition for Google's verification file
Click here to open tutorial.