YII Application does not work after changed to VPS Centos - .htaccess

The YII application was working before in shared hosting.
This is the YII application
http://www.jualrumahjakarta.com/iklan
These links are not working
www.jualrumahjakarta.com/iklan/site/login
www.jualrumahjakarta.com/iklan/user/register
htaccess in "iklan" folder
RewriteEngine on
# 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
in main.php
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'caseSensitive'=>false,
),
I have the same application for another website in shared hosting and it is working.
Please help me to solve this problem. Thanks.

Related

Is there a way to properly redirect or rewrite vistors in my drupal 8 website to a subfolder?

I have the following code in my .htaccess file:
RewriteEngine on
RewriteCond %{HTTP_HOST} mysitedomain\.com [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ /web/$1 [L]
I'm currently using CPanel and CPanel does not allow you to set a new Document Root. So have my drupal files in my CPanel "public_html" directory with the composer.json files etc..and web directory that has all the Drupal related files. I am trying to get the site vistors to rewrite or redirect to www.mysitedomain.com/web for subsequent pages.. I tried the code below but does not seem to work.. Am i missing something?
To be specific.... I need the site to 1. load www.mysitedomain.com/web when www.mysitedomain.com is requested. 2. And ensure /web is is front of every subsequent request page request within the site (ie. www.mysitedomain.com/web/products should load instead of www.mysitedomain.com/products)
I am not sure what your question is, but I think you need something like this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
What it does: If the URL does not resolve to a file or directory in the present directory, put index.php in front of it.
I'd assume your index.php would then include the Drupal framework.

.htaccess issue in LiteSpeed Web Server

Need help with litespeed web server .htaccess rules.
http://example.com/temp/home.php is existing URL, but now what we need to rewrite is mentioned below:
http://example.com/temp.php?redirect=home.php
And our Existing .htaccess code is also given below.
RewriteEngine on<br/>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^temp/(.*)$ temp.php?redirect=$1 [QSA,L]
But I don't know the issue, this rewrite still not working and shows 404 error because temp/home.php does not exist.
These rules are working perfectly with Apache server, but not working with Litespeed
For reference:
https://htaccess.madewithlove.be?share=d15d3bca-6974-5682-902a-823c1a63e2b7
Thanks in advance.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^temp/(.*)$ temp.php?redirect=$1 [QSA,L]
The above code will serve the content of temp.php?redirect=home.php.
As a test I created temp.php in the root directory of a domain, with the content:
<?php
var_dump($_GET);
The result when accessing /temp/home.php is:
array(1) {
["redirect"]=>
string(8) "home.php"
}
This is tested on LiteSpeed Web Server 5.3.4 and 5.3.5.

htaccess to nginx conversion reverse proxy to keep URL

i am using post affiliate pro and they have a script to turn a web page at www.example.com into a banner for affiliates, the htaccess uses a php script to load the affiliates info into the website/banner.
i am trying to convert the htaccess to nginx conf file. i have tried the converters at winginx and anilcetin
they work but it changes the url from www.example to pap.example.
on an Apache server with .htaccess the url is maintained www.example. this is what i am trying to duplicate on the nginx server.
here is the htaccess file.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/(.*) http://pap.example.com/scripts/page.php?a_aid=$1&a_bid=7c4ec277&a_file=$2 [L,P,QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+) http://pap.example.com/scripts/page.php?a_aid=$1&a_bid=7c4ec277&a_redir=Y [L,P,QSA]
thanks for any help
Sean

codeigniter application works on hostgator but not another web host

I have a codeigniter application that is working perfectly on my hostgator hosted domain.
I have configured .htaccess and config.php to remove the index.php from the URL. As mentioned this is working 100%. I now need to move the application from my hostgator server to a local server in South Africa with Afrihost.
the modified htaccess and config file are shown below:
my htaccess file is:
RewriteEngine on
RewriteBase /
# Prevent CI index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
# Prevent user access to the CI system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
# Prevent user access to the CI application folder
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
and my config.php file is:
$config['base_url'] = 'http://logicoportal.co.za';
$config['index_page'] = '';
// let me know if you need to see any other setting
When I try to browse to the domain http://www.logicoportal.co.za I get error This page can't be displayed.
If I browse to my ion auth controller, http://logicoportal.co.za/auth/login I get 404 error The webpage cannot be found.
If I browse to my full codeigniter default path, http://logicoportal.co.za/index.php/auth/login I get error This page can't be displayed
I am assuming it is an htaccess configuration error however I am not sure how to correct this. read many an article with no luck. Alternatively is there another config setting in codeigniter to support this?
I have spoken to the new hosting company, Afrihost and they say they cannot help in this regard.
Any advice / direction would be appreciated.
Thanks as always.
Working Solution:
htaccess file to remove index.php on shared hosting server
DirectoryIndex index.php
RewriteEngine on
RewriteCond %{REQUEST_URI} !^(index\.php|\.swf|forums|images|css|downloads|js|robots\.txt|favicon\.ico)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) ./index.php [L]
Try removing the ? in:
RewriteRule ^(.*)$ /index.php?/$1
So it's:
RewriteRule ^(.*)$ /index.php/$1

codeigniter block me from accesing my phpmyadmin installation on subdirectory

I have my own CMS built using CodeIgniter (actually, it's not me who developed it. My client gave it to me from their previous developer). No, I'm in the process of migrating the CMS to a new server. I set it up and everything works fine. Except, I can't access my phpmyadmin installation which reside on the subdirectory of my public_html (which contain the CodeIgniter CMS).
www.mysite.com <-- this to access my CodeIgniterCMS based website
www.mysite.com/phpmyadmin <-- this to access my phpmyadmin
installation, which currently inaccessible and just showing CI's
default 404 error page
This might have something to do with CodeIgniter routing configuration or htaccess file and stuff like that. But I'm a total newbie on both CodeIgniter and htaccess.
What should I do to make me able to access my phpmyadmin?
this is my codeigniter htaccess file
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
let me know what other information (chunk of code, config files etc) should I show here to give better detail of my environment
Your htaccess is not poking a hole through to let access to phpmyadmin.
try
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond $1 !^(phpmyadmin|index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Resources