public_html/ # www.domain.com
public_html/subdomain # subdomain.domain.com
public_html/.htaccess
public_html/subdomain/.htaccess
I have a subdomain subdomain.domain.com
I have .htaccess file under public_html
This htaccess file contains this code:
Options -MultiViews
RewriteEngine On
RewriteBase /
ReWriteCond %{HTTP_HOST} ^subdomain\.domain\.com$
ReWriteCond %{REQUEST_URI} !^/subdomain/
ReWriteRule ^(.*)$ /subdomain/$1
I need to install magento inside subdomain folder
.htaccess file inside this folder is:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L,QSA]
</IfModule>
Magento Installed successfully, But I am facing a problem:
http://subdomain.domain.com/admin (this url works)
but when I hit http://subdomain.domain.com/index.php/admin its shows "No input file specified."
All internal URLs in admin are also throwing same error.
Please help me what wrong I put in my htaccess
Thanks in advance.
Related
I have a small mvc application where I'm trying to force the url to go from www.example.com to www.example.com/public.
In order to do this, I have a .htaccess file in the root (/) and then another .htaccess within the /public folder to point to index.php with friendly urls. I believe the issue is within the htaccess file that sits in the public folder, I need all requests to go through index.php
I have tried a few threads on stackoverflow but seems to give me a server 500 error when I access www.example.com
.htaccess of root
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /public/
</IfModule>
.htaccess of public folder
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME}% !-f
RewriteCond %{REQUEST_FILENAME}% !-d
#allow images, css and js links
RewriteCond %{REQUEST_URI} !\.(css|js|jpe?g|gif|png)$ [NC]
RewriteRule ^(.*)$ index.php?url=$1 [PT,L]
</IfModule>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule (.*) /public/index.php
I've a wordpress installation inside a directory "public_html/mywebsite/"
. My root directory is "public_html/". My domain wwww.mywebsite.com pointed to the root folder "public_html/". Due to some reasons, I can't point the domain to the "mywebsite" folder. But I want to load the website from the "public_html/mywebsite/" directory when wwww.mywebsite.com is called. I tried with htaccess for this implementation. But not working.
In the "public_html/" directory, I put a .htaccess file and added the following code;
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?mywebsite.com$
RewriteRule ^(/)?$ mywebsite [L]
It redirects the website to the "mywebsite" folder but it returns 404 page of the wordpress website.
I modified the .htaccess of the wordpress directory like this;
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} !^/(mywebsite|mywebsite/.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Any idea to solve this?
I used the wordpress redirect rule based on the following link and this worked for me.
https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
For more security .I made a new folder with a long random name and installed Wordpress there .To redirect visitors to that wordpress folder without them noticing anything in URL, I made a .htaccess file and wrote this in it.
<Files .htaccess>
order allow,deny
deny from all
</Files>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/my_subdir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /my_subdir/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ my_subdir/index.php [L]
</IfModule>
first part is for security, second part is redirect.I replaced "my_subdir" with the random folder, and replaced "example.com" with my website.
The ERR_EMPTY_RESPONSE comes randomly on www.domain.com/ci_project
I have a shared hosting with multiple domain hosted on it. In the root folder of my hosting exists a .htaccess file. The code is as follows:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
And inside a folder there is a codeigniter site say ci_project. The htaccess is as follows
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
If I comment the htaccess file of the ci_project, www.domain.com/ci_project works fine without the random error But I need the htaccess file as it removes index.php from the url
Can anyone please tell how the issue can be resolved..
Try to open the pages in a browser other than Chrome.
If the issue (random error) is not appearing in other browsers then clear the browser cache of Chrome and then open the pages. This random error should disappear.
I'm having issues with .htaccess RewriteRule. all I'm trying to do is
rewrite this url - www.example.com/public/?q=admin
to - www.example.com/public/admin
but now when I go to this url www.example.com/public/admin it says not found.
but this url is working ww.example.com/public/?q=admin
here is my .htaccess code
Options All -Indexes
<FilesMatch "(config|.+\.html)\.php">
deny from all
</FilesMatch>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !\.(bmp|cgi|css|flv|gif|ico|jpe?g|js|png|swf|xml)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) ?q=$1&%1 [L,QSA]
</IfModule>
Does anyone know to help?
UPDATE
This script installed inside a subdomain and a sub folder
like this
http://subdomain.maindomain.com/comingsoon/
coming soon is the root folder
http://subdomain.maindomain.com/comingsoon/public is another folder where placed .htaccess file.
I'm using mini php framwork called Swiftlet
https://github.com/AliasIO/Swiftlet
You can use this rule in your .htaccess for your required url.
RewriteRule ^public/(.*)$ public?q=$1 [L,QSA]
UPDATE 1:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain.domain.com
RewriteRule ^public/(.*)$ http://subdomain.domain.com/comingsoon/public?q=$1 [L,NC,QSA]
Ok, so after your update, try this :
RewriteBase /comingsoon/public
RewriteRule ^(.*)$ /?q=$1 [L,QSA]
I am using this htaccess for my application.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Any URL I will type in my browser, if the respective file doesn't exist, it will open the index.php.
The problem is I have many applications like this installed on the same domain.
For example, the root contains an index.php file and a htaccess like above.
I have also, /store, which contains a index.php file and a htaccess like above, too, but when I access /store/something it opens the index.php of root (not the correct /store/index.php
How can I solve this problem (how to make the htaccess of root to not override the htaccess of /store)? Thanks!
You can have a skip directory rule to skip all the directories:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# skip index.php and some directories
RewriteRule ^(store/|site1/|site2/|index\.php$) - [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>