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'm struggling with the .htaccess file. I've wordpress installed in a subdirectory 'wordpress'. In the root folder if have the htaccess with the following content:
Order Allow,Deny
Allow from all
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$
RewriteRule !^wordpress/ /wordpress%{REQUEST_URI} [L,R=301]
</IfModule>
Redirection is working, but how can I hide the subfolder 'wordpress'?
THX in advance
EDIT: Tried following content now but still not working:
root htaccess:
Order Allow,Deny
Allow from all
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com
RewriteRule !^wordpress/ wordpress%{REQUEST_URI} [L]
</IfModule>
wordpress htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
EDIT2: my whole root htaccess looks like this now:
Allow from all
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com
RewriteRule !^wordpress/ wordpress%{REQUEST_URI} [L]
If i type in www.example.com I am redirected to example/wordpress/home, example/wordpress/contact and so on...
I would like to hide the wordpress directory like example/home, example/contact and so on
Redirection is working, but how can I hide the subfolder 'wordpress'?
You shouldn't be "redirecting". You should be internally rewriting the request instead. Remove the R flag.
For example:
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com
RewriteRule !^wordpress/ wordpress%{REQUEST_URI} [L]
The slash prefix on the susbtitution string is also not required.
This assumes you have the standard WP .htaccess file in the /wordpress subdirectory.
UPDATE: Also confirm you have removed the /wordpress subdirectory from the "Website Address" and "Site Address" in WordPress General settings.
I'm trying to create a subdomain for showing clients their websites in development, by creating a 'subdomains' folder within 'public_html', and then creating individual 'subdomain' folders within that 'subdomains' folder, and redirecting each new site to its associated folder.
My problem is I expect with my htaccess code, whereb navigating to, for example, subdomain.website.com, I get the error below:
"The requested URL /.php was not found on this server."
...
Here's the code for my htaccess at the moment, just not sure how I can alter this to allow me to use this setup for each future subdomain in the 'subdomains' folder without getting this issue.
ErrorDocument 404 /404.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
# RewriteEngine On
# RewriteCond %{HTTP_HOST} !^www\. [NC]
# RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Any help would be greatly appreciated as I'm in way over my head with htaccess stuff. Thank you in advance!
EDIT just confirming that the only file in the subdomain folder at the moment is an index.php file
Add this rule in top of your domain .htaccess file, %1 is your subdomain folder and $1 is your request (default document folder would be index.php).
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.*)\.example\.com
RewriteRule ^(.*)$ /%1/$1 [L,NC,QSA]
</IfModule>
Check manual entry of subdomain folder:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^subdomain\.example\.com
RewriteRule ^(.*)$ /subdomain/$1 [L,NC,QSA]
</IfModule>
I've got a duplicate content problem with my Symfony2 projet. The following urls gives the same content :
www.mywebsite.com/web/page and www.mywebsite.com/page
Here is the content of my /.htaccess file :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ web/$1 [QSA,L]
</IfModule>
And the content of my /web/.htaccess file :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
I would like to redirect any url starting with /web to / but I can't manage to do it. Do you have any suggestion ?
In the htaccess file in your web directory (the /web/.htaccess file), add these rules right beneath the RewriteEngine On:
RewriteCond %{THE_REQUEST} ^(GET|HEAD)\ /web/
RewriteRule ^(.*)$ /$1 [L,R=301]
This redirects all direct access to the web directory to the root.
In my website root I have the following to redirect to non www domain
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{http_host} ^www\.notails\.com [NC]
RewriteRule ^(.*)$ http://notails.com/$1 [R=301,NC]
in a subfolder named 'photography' I have this...
RewriteEngine on
RewriteRule ^show/([^/\.]+)/([^/]+)$ show.php?section=$1&photoid=$2 [L]
Anything inside the photography folder ignores the www removing rule. How do I get these two rules to both apply to folders/files within the photography folder?
Also... my root htaccess file has this...
# 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
Could it be interfering? I have a self-hosted wordpress blog but it's not in the root of the website, it's in a subfolder called 'blog' so I don't know why this rule is in my root's htaccess file. Can/should I move it?
Edit: Just to point out, in case it isn't obvious - I'm a complete noob when it comes to htaccess and mod_rewrite stuff. Does a htaccess file in a subfolder override any htaccess files nearer to the root than it? Or do the htaccess contents combine?
Edit 2: I have tried moving the second rule to the same htaccess file as the www removing rule as per the following code...
# 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
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{http_host} ^www\.notails\.com [NC]
RewriteRule ^(.*)$ http://notails.com/$1 [R=301,NC]
RewriteRule ^photography/show/([^/\.]+)/([^/]+)$ photography/show.php?section=$1&photoid=$2 [L]
If I then go to one of my photography pages it resolves to the intended url (http://notails.com/photography/show/pointofayre/260 for example) but the page is a 404.
If I manually add 'www' to that it undoes the other rule... (http://notails.com/show.php?section=pointofayre&photoid=260) and removes 'photography/' from it.
Add RewriteOptions inherit into .htaccess in your "photography" folder because right now all rewrite rules from parent folders are ignored (default behaviour).
Alternatively move rewrite rules from that subfolder .htaccess into root one (you will need to slightly modify your rule by fixing the path -- adding photography/ may be enough, depends on actual "photography" location)
UPDATE:
Your root .htaccess can be like this:
Options +FollowSymlinks
<IfModule mod_rewrite.c>
# activate rewrite engine
RewriteEngine On
# we are in the root
RewriteBase /
# no www please
RewriteCond %{HTTP_HOST} ^www\.notails\.com [NC]
RewriteRule ^(.*)$ http://notails.com/$1 [R=301,L,QSA]
# photography
RewriteRule ^photography/show/([^/\.]+)/([^/]+)$ /photography/show.php?section=$1&photoid=$2 [L]
# WordPress rules
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Working with cakePHP
My index.php is in www.domain.com/httpdocs/sub/app/webroot
Previously, on shared hosting I just replaced "domain.com/" with "domain.com/app+core directories" (without httpdocs/ or sub/)
I've moved to media temple dedicated virtual server and am hitting a 403 forbidden error:
"You don't have permission to access /sub/ on this server."
Permission is set to 755 for sub/ directory
In domain.com/sub/app -> .htaccess file:
Code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /sub/app/
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
In domain.com/sub/app/webroot -> .htaccess file:
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteBase /sub/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
I've tried:
Right now httpdocs/ contains blank index.html and simple redirect:
Redirect /index.html http://domain.com/sub/
Creating another .htaccess file for /sub, but that seemed to confound things further.
I'm on media temple, followed this article: http://wiki.mediatemple.net/w/403_Forbidden_error
Thanks
Noticed you were having some issues with your (dv). We just wanted to let you know that we are here to help you with any problems that you may have. If you keep running into these errors, please open up a Support Request so we can help you out.