CWP https non-www redirect failed in both htaccess and apache - .htaccess

i tried to make my website working only within non-www https (ex, https://customsite.tld)
i want all request to my domain to be server from "https://customsite.com"
i have tried to many things but all of them doesnt work & websites insists to open using same www url "https://www.customsite.com"
things that i have tried are as follows :
- i make sure that apache "rewrite_module" is loaded
changing AllowOverride to Allow within apache configurations (main & vhost config)
redirect within Apache configuration
Redirect permanent / https://customsite.com/
i used to many code within htacces the following is my current htaccess (but it doesnt work too)
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\.customsite\.com [NC]
RewriteRule (.*) https://customsite.com/$1 [L,R=301]
i also enabled rewrite log & when trying to accsee site using www it gives me the following
[Mon Sep 30 11:59:52.772074 2019] [rewrite:trace2] [pid 5473:tid 140059438470912] mod_rewrite.c(483): [client 197.37.110.119:59413] 197.37.110.119 - - [www.customsite.com/sid#13141e8][rid#7f620c01fcd0/initial] init rewrite engine with requested uri /login
[Mon Sep 30 11:59:52.772105 2019] [rewrite:trace1] [pid 5473:tid 140059438470912] mod_rewrite.c(483): [client 197.37.110.119:59413] 197.37.110.119 - - [www.customsite.com/sid#13141e8][rid#7f620c01fcd0/initial] pass through /login
[Mon Sep 30 11:59:52.895060 2019] [rewrite:trace2] [pid 5473:tid 140059430078208] mod_rewrite.c(483): [client 197.37.110.119:59413] 197.37.110.119 - - [www.customsite.com/sid#13141e8][rid#7f620c01a100/initial] init rewrite engine with requested uri /css/main.css, referer: https://www.customsite.com/login
[Mon Sep 30 11:59:52.895081 2019] [rewrite:trace1] [pid 5473:tid 140059430078208] mod_rewrite.c(483): [client 197.37.110.119:59413] 197.37.110.119 - - [www.customsite.com/sid#13141e8][rid#7f620c01a100/initial] pass through /css/main.css, referer: https://www.customsite.com/login
[Mon Sep 30 11:59:53.084281 2019] [rewrite:trace2] [pid 5472:tid 140059472041728] mod_rewrite.c(483): [client 197.37.110.119:59415] 197.37.110.119 - - [www.customsite.com/sid#13141e8][rid#7f620c01f870/initial] init rewrite engine with requested uri /css/auth.css, referer: https://www.customsite.com/login
[Mon Sep 30 11:59:53.084336 2019] [rewrite:trace1] [pid 5472:tid 140059472041728] mod_rewrite.c(483): [client 197.37.110.119:59415] 197.37.110.119 - - [www.customsite.com/sid#13141e8][rid#7f620c01f870/initial] pass through /css/auth.css, referer: https://www.customsite.com/login
[Mon Sep 30 11:59:53.665350 2019] [rewrite:trace2] [pid 5472:tid 140059455256320] mod_rewrite.c(483): [client 197.37.110.119:59415] 197.37.110.119 - - [www.customsite.com/sid#13141e8][rid#7f620c01a100/initial] init rewrite engine with requested uri /images/e-learn2.png, referer: https://www.customsite.com/login
[Mon Sep 30 11:59:53.665373 2019] [rewrite:trace1] [pid 5472:tid 140059455256320] mod_rewrite.c(483): [client 197.37.110.119:59415] 197.37.110.119 - - [www.customsite.com/sid#13141e8][rid#7f620c01a100/initial] pass through /images/e-learn2.png, referer: https://www.customsite.com/login
[Mon Sep 30 11:59:53.670419 2019] [rewrite:trace2] [pid 5473:tid 140059353282304] mod_rewrite.c(483): [client 197.37.110.119:59413] 197.37.110.119 - - [www.customsite.com/sid#13141e8][rid#7f620c01fcd0/initial] init rewrite engine with requested uri /images/bg7.png, referer: https://www.customsite.com/css/auth.css
[Mon Sep 30 11:59:53.670441 2019] [rewrite:trace1] [pid 5473:tid 140059353282304] mod_rewrite.c(483): [client 197.37.110.119:59413] 197.37.110.119 - - [www.customsite.com/sid#13141e8][rid#7f620c01fcd0/initial] pass through /images/bg7.png, referer: https://www.customsite.com/css/auth.css
i have Centos 7 with Centos Web Panel installed, & the script is running on nodejs so i am proxying nodejs to port 80 using the following
ProxyPass / http://127.0.0.1:4000/
ProxyPassReverse / http://127.0.0.1:4000/
the problem is that the website no matter any htaccess code nor redirect within apache it is always opening "https://www.customsite.com"
i need it to be without www & only within https
why this doesnt work ? this is getting me very crazy !!
any help will be appreciated
thanks in advance for eveyone,,

i used mod env to redirect instead of htaccess,
thanks for all

Related

how can i separate the mainDomain and the subDomains use mod-rewrite with htaccess file

I want to redirect subdomains on my site if they are queried, but if I do not query, I want to redirect it to a different domain.
I have reached some codes by searching the internet, but I have not improved.
If I can not tell what I want to do, I want the following url and file structure to be the same as I showed.
public_html/
|____.htaccess (main htaccess)
|____index.php (php empty)
|____mainDomain/
| |_____.htaccess (without subdomain htaccess)
| |_____index.php
| |_____public/
| | |____.htaccess (application htaccess)
| | |____index.php
|____subsDomain/
| |_____ucgen/
| |_____testFolder/
main htaccess:
RewriteCond %{ENV:REDIRECT_SUBDOMAIN} =""
RewriteCond %{HTTP_HOST} ^([a-z0-9][-a-z0-9]+)\.metehanboy\.com\.?(:80)?$ [NC]
RewriteCond %{DOCUMENT_ROOT}/subsDomain/%1 -d
RewriteRule ^(.*) subsDomain/%1/$1 [E=SUBDOMAIN:%1,L]
RewriteRule ^ - [E=SUBDOMAIN:%{ENV:REDIRECT_SUBDOMAIN},L]
RewriteRule ^$ mainDomain/ [L]
RewriteRule (.*) mainDomain/$1 [QSA,L]
without subdomain htaccess
RewriteEngine on
RewriteRule ^$ public/ [QSA,L]
RewriteRule (.*) public/$1 [QSA,L]
application htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?hedef=$1 [PT,L]
I added cpanelden subdomains but infiniteloop happens when I run the subdomain, how can I fix this?
example subdomain link: http://ucgen.metehanboy.com/example/example
other link: http://metehanboy.com/authentication/index
mainDomain folder include mvc php app
subsDomain folder includes test application scripts
Apache Error Log
[Wed May 02 14:16:26.044185 2018] [core:alert] [pid 3117] [client 95.70.153.106:59513] /home/metehanboy/public_html/.htaccess: Invalid command 'RewriteLog', perhaps misspelled or defined by a module not included in the server configuration
[Wed May 02 14:16:26.043954 2018] [core:alert] [pid 3117] [client 95.70.153.106:59513] /home/metehanboy/public_html/.htaccess: Invalid command 'RewriteLog', perhaps misspelled or defined by a module not included in the server configuration
[Wed May 02 14:15:42.256845 2018] [core:alert] [pid 2690] [client 95.70.153.106:59497] /home/metehanboy/public_html/.htaccess: Invalid command 'RewriteLogLevel', perhaps misspelled or defined by a module not included in the server configuration
[Wed May 02 14:15:42.256734 2018] [core:alert] [pid 2690] [client 95.70.153.106:59497] /home/metehanboy/public_html/.htaccess: Invalid command 'RewriteLogLevel', perhaps misspelled or defined by a module not included in the server configuration
[Wed May 02 14:15:34.964648 2018] [core:alert] [pid 2641] [client 95.70.153.106:59496] /home/metehanboy/public_html/.htaccess: Invalid command 'RewriteLogLevel', perhaps misspelled or defined by a module not included in the server configuration
[Wed May 02 14:15:34.964434 2018] [core:alert] [pid 2641] [client 95.70.153.106:59496] /home/metehanboy/public_html/.htaccess: Invalid command 'RewriteLogLevel', perhaps misspelled or defined by a module not included in the server configuration
[Wed May 02 14:15:21.351847 2018] [core:alert] [pid 2696] [client 95.70.153.106:59491] /home/metehanboy/public_html/.htaccess: Invalid command 'RewriteLogLevel', perhaps misspelled or defined by a module not included in the server configuration
[Wed May 02 14:15:21.351768 2018] [core:alert] [pid 2696] [client 95.70.153.106:59491] /home/metehanboy/public_html/.htaccess: Invalid command 'RewriteLogLevel', perhaps misspelled or defined by a module not included in the server configuration
[Wed May 02 14:13:47.582923 2018] [core:error] [pid 3117] [client 95.70.153.106:59459] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://ucgen.metehanboy.com/
[Wed May 02 14:13:47.582877 2018] [core:error] [pid 3117] [client 95.70.153.106:59459] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://ucgen.metehanboy.com/
[Wed May 02 14:13:46.839964 2018] [core:error] [pid 3118] [client 95.70.153.106:59457] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://ucgen.metehanboy.com/
[Wed May 02 14:13:46.839899 2018] [core:error] [pid 3118] [client 95.70.153.106:59457] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://ucgen.metehanboy.com/
[Wed May 02 14:13:39.737762 2018] [core:error] [pid 2696] [client 95.70.153.106:59446] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://ucgen.metehanboy.com/
[Wed May 02 14:13:39.737686 2018] [core:error] [pid 2696] [client 95.70.153.106:59446] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://ucgen.metehanboy.com/
In cPanel, you can add subdomains adjacent to your main domain, instead of a subdirectory. Why do you need that over-complicated structure? What's the benefit? Use something like this and save yourself the headache:
public_html/
|____.htaccess (application htaccess)
|____index.php
public_html_ucgen/
|____.htaccess (subdomain htaccess)
|____index.php

.htaccess error in Codeigniter3

I have a website files in hosting account. And here is this .htaccess file in the root of directory
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png)
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}
#AddHandler application/x-httpd-php56 .php .php5 .php4 .php3
Also, I added a new website folder 'nigaratakishizadeh.com' to the root and uploaded my CI files there. When I enter the website ( http://nigaratakishizadeh.com ), it gives me an error 500 Internal
500 - Internal Server Error This is a temporary server error. Please
try to reload the webpage later.
However, when I change nigaratakishizadeh.com folder's htaccess to RewriteEngine off, it opens the website. What is the problem?
Here is my .htaccess file in the nigaratakishizadeh.com directory:
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png)
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^(.*)$ ./index.php/$1 [L]
php_value upload_max_filesize 30M
Here is the server apache error logs:
[Sun Apr 29 08:16:29.548592 2018] [core:alert] [pid 33453] [client 181.224.135.93:39158] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Sun Apr 29 08:16:29.341526 2018] [core:alert] [pid 38466] [client 181.224.135.93:39098] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Sun Apr 29 08:16:27.622224 2018] [core:alert] [pid 43795] [client 181.224.135.93:38904] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Sun Apr 29 08:16:27.261333 2018] [core:alert] [pid 42837] [client 181.224.135.93:38864] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Sun Apr 29 08:16:23.581238 2018] [core:alert] [pid 38407] [client 181.224.135.93:38614] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Sun Apr 29 08:16:22.294281 2018] [core:alert] [pid 38523] [client 181.224.135.93:38538] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Sun Apr 29 08:16:20.994017 2018] [core:alert] [pid 38526] [client 181.224.135.93:38430] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Sun Apr 29 08:16:20.778064 2018] [core:alert] [pid 36546] [client 181.224.135.93:38378] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Sun Apr 29 08:16:20.778064 2018] [core:alert] [pid 38523] [client 181.224.135.93:38376] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration, referer: http://nigaratakishizadeh.com/
[Sun Apr 29 08:16:20.042254 2018] [core:alert] [pid 42837] [client 181.224.135.93:38276] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration, referer: http://nigaratakishizadeh.com/
[Sun Apr 29 08:16:20.009329 2018] [core:alert] [pid 33453] [client 181.224.135.93:38266] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Sun Apr 29 08:16:19.804285 2018] [core:alert] [pid 38528] [client 181.224.135.93:38236] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration, referer: http://nigaratakishizadeh.com/
[Sun Apr 29 08:16:19.742617 2018] [core:alert] [pid 38527] [client 181.224.135.93:38228] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Sun Apr 29 08:16:19.535860 2018] [core:alert] [pid 38526] [client 181.224.135.93:38124] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration, referer: http://nigaratakishizadeh.com/
[Sun Apr 29 08:16:19.178688 2018] [core:alert] [pid 38528] [client 181.224.135.93:38038] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Sun Apr 29 08:16:18.973287 2018] [core:alert] [pid 38466] [client 181.224.135.93:37990] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration, referer: http://nigaratakishizadeh.com/
[Sun Apr 29 08:16:18.383334 2018] [core:alert] [pid 38526] [client 181.224.135.93:37862] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Sun Apr 29 08:16:18.173713 2018] [core:alert] [pid 42837] [client 181.224.135.93:37826] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration, referer: http://nigaratakishizadeh.com/
[Sun Apr 29 08:16:06.847039 2018] [core:alert] [pid 38523] [client 181.224.135.93:35942] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Sun Apr 29 08:16:05.703058 2018] [core:alert] [pid 33453] [client 181.224.135.93:35858] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration, referer: http://nigaratakishizadeh.com/
[Sun Apr 29 08:16:05.101583 2018] [core:alert] [pid 38527] [client 181.224.135.93:35786] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Sun Apr 29 08:16:04.895922 2018] [core:alert] [pid 42837] [client 181.224.135.93:35756] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration, referer: http://nigaratakishizadeh.com/
[Sun Apr 29 08:16:04.391211 2018] [core:alert] [pid 38526] [client 181.224.135.93:35702] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Sun Apr 29 08:16:04.122189 2018] [core:alert] [pid 42837] [client 181.224.135.93:35648] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration, referer: http://nigaratakishizadeh.com/
[Sun Apr 29 08:16:03.218603 2018] [core:alert] [pid 38526] [client 181.224.135.93:35530] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Sun Apr 29 08:11:50.044065 2018] [core:alert] [pid 7912] [client 181.224.135.93:33050] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:11:48.010489 2018] [core:alert] [pid 7912] [client 181.224.135.93:60890] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:11:47.751755 2018] [core:alert] [pid 14231] [client 181.224.135.93:60852] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:11:46.422532 2018] [core:alert] [pid 2990] [client 181.224.135.93:60692] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:11:19.255974 2018] [core:alert] [pid 12220] [client 181.224.135.93:56988] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:11:15.718812 2018] [core:alert] [pid 2522] [client 181.224.135.93:56666] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:11:15.490073 2018] [core:alert] [pid 12918] [client 181.224.135.93:56638] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:11:15.320300 2018] [core:alert] [pid 8370] [client 181.224.135.93:56608] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:11:14.989071 2018] [core:alert] [pid 12918] [client 181.224.135.93:56570] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:11:10.808651 2018] [core:alert] [pid 12918] [client 181.224.135.93:56064] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:11:10.426044 2018] [core:alert] [pid 12918] [client 181.224.135.93:56020] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:11:09.269472 2018] [core:alert] [pid 12220] [client 181.224.135.93:55938] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:11:08.937889 2018] [core:alert] [pid 2828] [client 181.224.135.93:55904] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:11:08.323260 2018] [core:alert] [pid 2522] [client 181.224.135.93:55872] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:10:33.954696 2018] [core:alert] [pid 56003] [client 181.224.135.93:53066] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Sun Apr 29 08:10:28.173501 2018] [core:alert] [pid 7912] [client 181.224.135.93:52686] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Sun Apr 29 08:10:27.670770 2018] [core:alert] [pid 2990] [client 181.224.135.93:52664] /home/javid020/public_html/nigaratakishizadeh.com/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
[Sun Apr 29 08:09:37.739238 2018] [core:alert] [pid 2990] [client 181.224.135.93:51750] /home/javid020/public_html/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:09:34.847641 2018] [core:alert] [pid 2990] [client 181.224.135.93:51550] /home/javid020/public_html/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:09:34.640236 2018] [core:alert] [pid 45433] [client 181.224.135.93:51530] /home/javid020/public_html/.htaccess: </IfModule without matching <IfModule section, referer: https://www.wtf.az/courses
[Sun Apr 29 08:09:33.541211 2018] [core:alert] [pid 3110] [client 181.224.135.93:51446] /home/javid020/public_html/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:09:33.321420 2018] [core:alert] [pid 50479] [client 181.224.135.93:51440] /home/javid020/public_html/.htaccess: </IfModule without matching <IfModule section, referer: https://www.wtf.az/courses
[Sun Apr 29 08:09:33.124587 2018] [core:alert] [pid 2828] [client 181.224.135.93:51426] /home/javid020/public_html/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:09:32.919041 2018] [core:alert] [pid 7834] [client 181.224.135.93:51408] /home/javid020/public_html/.htaccess: </IfModule without matching <IfModule section, referer: https://www.wtf.az/courses
[Sun Apr 29 08:09:32.820198 2018] [core:alert] [pid 3110] [client 181.224.135.93:51402] /home/javid020/public_html/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:09:13.463839 2018] [core:alert] [pid 45433] [client 181.224.135.93:49724] /home/javid020/public_html/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:09:13.320793 2018] [core:alert] [pid 3110] [client 181.224.135.93:49716] /home/javid020/public_html/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:09:13.258574 2018] [core:alert] [pid 2990] [client 181.224.135.93:49710] /home/javid020/public_html/.htaccess: </IfModule without matching <IfModule section, referer: https://www.wtf.az/courses
[Sun Apr 29 08:09:12.506714 2018] [core:alert] [pid 2990] [client 181.224.135.93:49654] /home/javid020/public_html/.htaccess: </IfModule without matching <IfModule section, referer: https://www.wtf.az/courses
[Sun Apr 29 08:09:11.796429 2018] [core:alert] [pid 2828] [client 181.224.135.93:49580] /home/javid020/public_html/.htaccess: </IfModule without matching <IfModule section
[Sun Apr 29 08:09:10.569661 2018] [core:alert] [pid 39620] [client 181.224.135.93:49444] /home/javid020/public_html/.htaccess: </IfModule without matching <IfModule section, referer: https://www.wtf.az/courses
[Sun Apr 29 08:09:09.945440 2018] [core:alert] [pid 39620] [client 181.224.135.93:49404] /home/javid020/public_html/.htaccess: </IfModule without matching <IfModule section
There can be different reason behind it (like you have not loaded rewrite_module). Check your server's apache error log for detail about this error & take action accordingly.
Then you can add some condition with code like
<IfModule mod_rewrite.c>
SetEnv HTTP_MOD_REWRITE On
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png)
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}
#AddHandler application/x-httpd-php56 .php .php5 .php4 .php3
</IfModule >
Every Line in your .htaccess file is correct.
you are getting 500 - Internal server error because you do not have permission to set these values by .htaccess.
You have to contact your web server providers and ask to set AllowOverride Options for your host or to put these lines in their virtual host configuration file.
see the Apache AllowOverride directive

Internal server error - htaccess file lines that make me

I have a following set of lines in the downloaded folder, when opening in the htaccess fil, i found these lines on the htaccess file.
Is it related to wamp server, i newly installed in my localhost.
<IfModule mod_expires.c>
<FilesMatch ".(ico|gif|jpe?g|png|swf|css|js|txt)$">
ExpiresActive On
ExpiresDefault "access plus 1 day"
ExpiresByType image/gif "modification plus 1 day"
</FilesMatch>
</IfModule>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* ./index.php
Apache error log
[Tue Mar 17 14:33:05.181448 2015] [mpm_winnt:notice] [pid 6608:tid 528] AH00455: Apache/2.4.9 (Win64) PHP/5.5.12 configured -- resuming normal operations
[Tue Mar 17 14:33:05.182449 2015] [mpm_winnt:notice] [pid 6608:tid 528] AH00456: Apache Lounge VC11 Server built: Mar 16 2014 12:42:59
[Tue Mar 17 14:33:05.182449 2015] [core:notice] [pid 6608:tid 528] AH00094: Command line: 'c:\\wamp\\bin\\apache\\apache2.4.9\\bin\\httpd.exe -d C:/wamp/bin/apache/apache2.4.9'
[Tue Mar 17 14:33:05.186454 2015] [mpm_winnt:notice] [pid 6608:tid 528] AH00418: Parent: Created child process 5336
[Tue Mar 17 14:33:05.800324 2015] [mpm_winnt:notice] [pid 5336:tid 448] AH00354: Child: Starting 64 worker threads.
[Tue Mar 17 14:33:07.423483 2015] [core:alert] [pid 5336:tid 960] [client ::1:56548] C:/wamp/www/smart/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
what is these mean and can you guys help me this
Thanks,
[Tue Mar 17 14:33:07.423483 2015] [core:alert] [pid 5336:tid 960]
[client ::1:56548] C:/wamp/www/smart/.htaccess: Invalid command
'RewriteEngine', perhaps misspelled or defined by a module not
included in the server configuration
Apache doesn't know what command that is because you have to enable the module. In order for most things to work in Apache the module has to be enabled. Now some are enabled by default and some aren't.
You need to edit your Apache config and uncomment the module_rewrite line.
LoadModule rewrite_module modules/mod_rewrite.so

CakePHP and EasyPHP

I'm new in PHP and I'm facing some problems.
I'm using EasyPHP (DevServer 14.1 -> PHP 5.5.8 and Apache 2.4.7) and CakePHP (2.5.1).
Well, if I put the CakePHP files at "C:\Program Files\EasyPHP\data\localweb\" (then it would be "C:\Program Files\EasyPHP\data\localweb\cake_2_0..." for example), it works fine, as it should.
The problem is: I would like to use alias on EasyPHP, for I don't want to develop at "C:\Program Files...". But when I put the CakePHP files on my application root ("C:\myapps\myproject..." for example, with an alias set on EasyPHP), then I get a "Error 404". Now, I found that if I remove the .htaccess file from root, it works. But I'm sure this file is there for some reason, so I don't feel right just removing it - it might give me more problems later.
Does anyone know anything about it? Can I use alias on EasyPHP if I want to use CakePHP?
Thanks in advance.
Edited
This is my apache_alias.conf (C:\Program Files\EasyPHP-DevServer-14.1VC11\data\conf):
Alias "/cakeblogtutorial" "C:/Programacao/PHP/workspace/CakeBlogTutorial"
<Directory "C:/Programacao/PHP/workspace/CakeBlogTutorial">
Options FollowSymLinks Indexes
AllowOverride All
Order deny,allow
Allow from 127.0.0.1
Deny from all
Require all granted
</Directory>
This is my .htaccess (C:\Programacao\PHP\workspace\CakeBlogTutorial):
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
On my httpd.conf (C:\Program Files\EasyPHP-DevServer-14.1VC11\binaries\conf_files), regarding to mod_rewrite (in other words, uncommented):
LoadModule rewrite_module modules/mod_rewrite.so
Last lines on error.log (C:\Program Files\EasyPHP-DevServer-14.1VC11\binaries\apache\logs):
[Mon Jun 02 14:27:48.093057 2014] [:error] [pid 4284:tid 848] [client 127.0.0.1:62831] script 'C:/Program Files/EasyPHP-DevServer-14.1VC11/data/localweb/index.php' not found or unable to stat
[Mon Jun 02 14:34:59.319532 2014] [mpm_winnt:notice] [pid 1992:tid 312] AH00424: Parent: Received restart signal -- Restarting the server.
[Mon Jun 02 14:34:59.982390 2014] [mpm_winnt:notice] [pid 1992:tid 312] AH00455: Apache/2.4.7 (Win32) PHP/5.5.8 configured -- resuming normal operations
[Mon Jun 02 14:34:59.982390 2014] [mpm_winnt:notice] [pid 1992:tid 312] AH00456: Apache Lounge VC11 Server built: Nov 21 2013 20:13:01
[Mon Jun 02 14:34:59.982390 2014] [core:notice] [pid 1992:tid 312] AH00094: Command line: 'C:\\PROGRA~1\\EASYPH~1.1VC\\binaries\\apache\\bin\\eds-httpd.exe -d C:/Program Files/EasyPHP-DevServer-14.1VC11/binaries/apache'
[Mon Jun 02 14:34:59.988391 2014] [mpm_winnt:notice] [pid 1992:tid 312] AH00418: Parent: Created child process 6588
[Mon Jun 02 14:35:01.279844 2014] [mpm_winnt:notice] [pid 6588:tid 364] AH00354: Child: Starting 64 worker threads.
[Mon Jun 02 14:35:01.523147 2014] [mpm_winnt:notice] [pid 4284:tid 364] AH00364: Child: All worker threads have exited.
Last lines on access.log (C:\Program Files\EasyPHP-DevServer-14.1VC11\binaries\apache\logs):
127.0.0.1 - - [02/Jun/2014:15:09:50 -0300] "GET /cakeblogtutorial HTTP/1.1" 301 242
127.0.0.1 - - [02/Jun/2014:15:09:50 -0300] "GET /cakeblogtutorial/ HTTP/1.1" 404 1156
I guess I found the answer - and if so, the RewriteBase is the correct thing to do. From the CakePHP WebSite (http://book.cakephp.org/2.0/en/installation/url-rewriting.html):
For many hosting services (GoDaddy, 1and1), your web server is actually being served from a user directory that already uses mod_rewrite. If you are installing CakePHP into a user directory (http://example.com/~username/cakephp/), or any other URL structure that already utilizes mod_rewrite, you’ll need to add RewriteBase statements to the .htaccess files CakePHP uses (/.htaccess, /app/.htaccess, /app/webroot/.htaccess).

Making nice Urls in Yii

I red a lot of tuttorials, but all lead me to the same error - Error 500 - Either the server is overloaded or there was an error in a CGI script.
I'm using xampp on Windows and cofigured httpd.conf like this
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
</Directory>
changed in yii main.php
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'caseSensitive'=>false,
'rules'=>array(
'' => 'site/index',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
and added .htaccess in root folder (the same level where protected folder)
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
RewriteBase /tests/
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
But no matter what I write in .htaccess, I get this error. When I commented all out, links from yii are generated ok (without index.php), but then I have 404 error, because of wrong server configuration.
EDIT:
And error.log last few records:
[Wed Nov 27 11:32:31.100063 2013] [core:alert] [pid 9520:tid 1572] [client ::1:58620] C:/Users/kristineg/xamps/htdocs/xampp/tests/.htaccess: Options not allowed here
[Wed Nov 27 11:32:31.372163 2013] [core:alert] [pid 9520:tid 1572] [client ::1:58621] C:/Users/kristineg/xamps/htdocs/xampp/tests/.htaccess: Options not allowed here
[Wed Nov 27 11:32:34.674379 2013] [core:alert] [pid 9520:tid 1572] [client ::1:58622] C:/Users/kristineg/xamps/htdocs/xampp/tests/.htaccess: Options not allowed here
[Wed Nov 27 11:32:36.587084 2013] [core:alert] [pid 9520:tid 1572] [client ::1:58623] C:/Users/kristineg/xamps/htdocs/xampp/tests/.htaccess: Options not allowed here
[Wed Nov 27 11:32:54.899832 2013] [core:alert] [pid 9520:tid 1572] [client ::1:58624] C:/Users/kristineg/xamps/htdocs/xampp/tests/.htaccess: Options not allowed here
[Wed Nov 27 11:54:14.056192 2013] [core:alert] [pid 9520:tid 1572] [client ::1:59297] C:/Users/kristineg/xamps/htdocs/xampp/tests/.htaccess: Options not allowed here
[Wed Nov 27 11:54:14.687425 2013] [core:alert] [pid 9520:tid 1572] [client ::1:59298] C:/Users/kristineg/xamps/htdocs/xampp/tests/.htaccess: Options not allowed here
[Wed Nov 27 15:53:27.459885 2013] [ssl:warn] [pid 11320:tid 308] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name
[Wed Nov 27 15:53:27.525911 2013] [core:warn] [pid 11320:tid 308] AH00098: pid file C:/Users/kristineg/xamps/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Wed Nov 27 15:53:27.588934 2013] [ssl:warn] [pid 11320:tid 308] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name
[Wed Nov 27 15:53:27.625947 2013] [mpm_winnt:notice] [pid 11320:tid 308] AH00455: Apache/2.4.4 (Win32) OpenSSL/1.0.1e PHP/5.5.1 configured -- resuming normal operations
[Wed Nov 27 15:53:27.625947 2013] [mpm_winnt:notice] [pid 11320:tid 308] AH00456: Server built: Feb 23 2013 12:42:00
[Wed Nov 27 15:53:27.625947 2013] [core:notice] [pid 11320:tid 308] AH00094: Command line: 'c:\users\kristineg\xamps\apache\bin\httpd.exe -d C:/Users/kristineg/xamps/apache'
[Wed Nov 27 15:53:27.627948 2013] [mpm_winnt:notice] [pid 11320:tid 308] AH00418: Parent: Created child process 4472
[Wed Nov 27 15:53:27.998083 2013] [ssl:warn] [pid 4472:tid 336] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name
[Wed Nov 27 15:53:28.143138 2013] [ssl:warn] [pid 4472:tid 336] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name
[Wed Nov 27 15:53:28.186154 2013] [mpm_winnt:notice] [pid 4472:tid 336] AH00354: Child: Starting 150 worker threads.
[Wed Nov 27 15:53:38.827074 2013] [core:alert] [pid 4472:tid 1640] [client ::1:61797] C:/Users/kristineg/xamps/htdocs/xampp/tests/.htaccess: Options not allowed here
[Wed Nov 27 15:53:39.614364 2013] [core:alert] [pid 4472:tid 1652] [client ::1:61796] C:/Users/kristineg/xamps/htdocs/xampp/tests/.htaccess: Options not allowed here
[Wed Nov 27 15:53:39.958491 2013] [core:alert] [pid 4472:tid 1640] [client ::1:61798] C:/Users/kristineg/xamps/htdocs/xampp/tests/.htaccess: Options not allowed here
[Wed Nov 27 15:53:40.295616 2013] [core:alert] [pid 4472:tid 1652] [client ::1:61799] C:/Users/kristineg/xamps/htdocs/xampp/tests/.htaccess: Options not allowed here
[Wed Nov 27 16:32:32.894114 2013] [core:alert] [pid 4472:tid 1640] [client ::1:62407] C:/Users/kristineg/xamps/htdocs/xampp/tests/.htaccess: Options not allowed here
I think you don't have the mode_rewrite module loaded in your server's main config. For starters, modify your .htaccess so it looks like this:
IndexIgnore */*
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /tests/
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
</IfModule>
If things change for the better (i.e. no 500-errors), see your main httpd.conf and look for a line that starts like this:
#LoadModule rewrite_module ...
Uncomment that line by removing the leading # and restart the server process.
As for the "Options not allowed here" error, see this answer.

Resources