I am trying to transfer my site from a shared cpanel host to my own VPS running Cyberpanel and OLS, this issue I am having is I cant get rewrites to work what-so-ever.
Any help would be appreciated as this has been doing my head in for the last 2 days/
Here is the .htaccess file I have:
RewriteEngine On
ErrorDocument 403 /assets/error/403.html
ErrorDocument 404 /assets/error/404.html
ErrorDocument 500 /assets/error/500.html
# Redirect www to non-www
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^ %{REQUEST_SCHEME}://%1%{REQUEST_URI} [R=301,L]
# Global URL
RewriteRule ^page/([^/]*)\.html$ /?page=$1 [L]
RewriteRule ^page/([^/]*)/x/([^/]*)\.html$ /?page=$1&x=$2 [L]
RewriteRule ^page/([^/]*)/edit/([^/]*)\.html$ /?page=$1&edit=$2 [L]
RewriteRule ^page/([^/]*)/delete/([^/]*)\.html$ /?page=$1&delete=$2 [L]
RewriteRule ^page/([^/]*)/recover/([^/]*)\.html$ /?page=$1&recover=$2 [L]
RewriteRule ^page/([^/]*)/activate/([^/]*)\.html$ /?page=$1&activate=$2 [L]
RewriteRule ^page/([^/]*)/x/([^/]*)/y/([^/]*)\.html$ /?page=$1&x=$2&y=$3 [L]
RewriteRule ^offerwall/([^/]*)/([^/]*)$ /offerwall.php?key=$1&sub_id=$2 [L]
RewriteRule ^lead/status/([^/]*)$ /lead.php?status=$1 [L]
RewriteRule ^lead/([^/]*)/([^/]*)/([^/]*)/([^/]*)$ /lead.php?hash=$1&key=$2&sid=$3&token=$4 [L]
RewriteRule ^go/([^/]*)$ /offer.php?key=$1 [L]
RewriteRule ^shortlink/load/([^/]*)$ /redirect.php?load=$1 [L]
RewriteRule ^shortlink/result/([^/]*)/([^/]*)/([^/]*)$ /shortlink.php?short_key=$1&sub_id=$2&site_id=$3 [L]
RewriteRule ^shortlink/([^/]*)/([^/]*)/([^/]*)/([^/]*)$ /redirect.php?api=$1&sub_id=$2&short_id=$3&token=$4 [L]
# Publisher URL
RewriteRule ^publisher.html$ /publisher.php [L]
RewriteRule ^publisher/([^/]*)\.html$ /publisher.php?page=$1 [L]
RewriteRule ^publisher/([^/]*)/x/([^/]*)\.html$ /publisher.php?page=$1&x=$2 [L]
RewriteRule ^publisher/([^/]*)/edit/([^/]*)\.html$ /publisher.php?page=$1&edit=$2 [L]
RewriteRule ^publisher/([^/]*)/delete/([^/]*)\.html$ /publisher.php?page=$1&delete=$2 [L]
RewriteRule ^publisher/([^/]*)/x/([^/]*)/y/([^/]*)\.html$ /publisher.php?page=$1&x=$2&y=$3 [L]
# Advertiser URL
RewriteRule ^advertiser.html$ /advertiser.php [L]
RewriteRule ^advertiser/([^/]*)\.html$ /advertiser.php?page=$1 [L]
RewriteRule ^advertiser/([^/]*)/x/([^/]*)\.html$ /advertiser.php?page=$1&x=$2 [L]
RewriteRule ^advertiser/([^/]*)/edit/([^/]*)\.html$ /advertiser.php?page=$1&edit=$2 [L]
RewriteRule ^advertiser/([^/]*)/delete/([^/]*)\.html$ /advertiser.php?page=$1&delete=$2 [L]
RewriteRule ^advertiser/([^/]*)/x/([^/]*)/y/([^/]*)\.html$ /advertiser.php?page=$1&x=$2&y=$3 [L]
# Admin Rewrite
RewriteRule ^admin.html$ /admin.php [L]
RewriteRule ^admin/([^/]*)\.html$ /admin.php?page=$1 [L]
RewriteRule ^admin/([^/]*)/x/([^/]*)\.html$ /admin.php?page=$1&x=$2 [L]
RewriteRule ^admin/([^/]*)/x/([^/]*)/y/([^/]*)\.html$ /admin.php?page=$1&x=$2&y=$3 [L]
RewriteRule ^admin/([^/]*)/edit/([^/]*)\.html$ /admin.php?page=$1&edit=$2 [L]
RewriteRule ^admin/([^/]*)/delete/([^/]*)\.html$ /admin.php?page=$1&delete=$2 [L]
RewriteRule ^admin/([^/]*)/pay/([^/]*)\.html$ /admin.php?page=$1&pay=$2 [L]
RewriteRule ^admin/([^/]*)/mark/([^/]*)\.html$ /admin.php?page=$1&mark=$2 [L]
RewriteRule ^admin/([^/]*)/reject/([^/]*)\.html$ /admin.php?page=$1&reject=$2 [L]
RewriteRule ^admin/([^/]*)/confirm/([^/]*)\.html$ /admin.php?page=$1&confirm=$2 [L]
# Protect .htaccess
<Files .htaccess>
order allow,deny
deny from all
</Files>
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>
<ifModule mod_headers.c>
# Enable Keep Alive
Header set Connection keep-alive
# Properly handle requests coming from behind proxies
Header append Vary User-Agent
# Turn on Expires
ExpiresActive On
# Turn off ETag
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)(\.gz)?$">
Header unset ETag
FileETag None
</FilesMatch>
# Set up caching on media files for 5 weeks
<FilesMatch "\.(gif|jpg|jpeg|png|swf|flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|ttf|woff|woff2|svg)$">
ExpiresDefault A3024000
Header append Cache-Control "public"
</FilesMatch>
# Set up 7 days caching on commonly updated files
<FilesMatch "\.(xml|txt|html|js|css)$">
ExpiresDefault A604800
Header append Cache-Control "proxy-revalidate"
</FilesMatch>
# Force no caching for dynamic files
<FilesMatch "\.(php|cgi|pl|htm)$">
ExpiresActive Off
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
Header set Pragma "no-cache"
</FilesMatch>
</ifModule>