I seem to be having an interesting problem in that .htaccess isn't routing to /public_html/index.html by default as it should, and I'm getting a page not found error. I do know that someone tampered with the file recently but have no idea what they did and I unfortunately know nothing about routing. I tried to do some research but didn't come up with anything that gave a solution to my predicament. Does anyone know how to go about making the server route to public_html? Here's what I have right now.
RewriteEngine on
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName evolvingwebcreations.com
#-------------------------
RewriteCond %{HTTP_HOST} ^swinkapps.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.swinkapps.com$
RewriteRule ^(.*) "http\:\/\/127\.0\.0\.1\:12005\/$1" [P,L]
#-------------------------
RewriteCond %{HTTP_HOST} ^swinkapps.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.swinkapps.com$
RewriteRule ^clients(.*) "http\:\/\/127\.0\.0\.1\:12005\/$1" [P,L]
Thanks in advance!
I don't believe it ever routes to public_html by default. You'll need to specify
UserDir public_html
and possibly set some access permissions such as
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options Indexes SymLinksIfOwnerMatch IncludesNoExec
</Directory>
Related
I am developing an application that's hosted on an apache server with PHP 5.
There is a website already running on the domain: www.domain.com. My application is on a folder called 'hotsite', and it can be accessed by the url www.domain.com/hotsite/.
The root folder contains a .htaccess containing:
/.htaccess:
XBitHack Off
RewriteEngine On
RewriteCond %{REQUEST_URI} \/([0-9a-z]{6})$ [NC]
RewriteRule ^(.*) http://www.domain.com/url/forward.php?%1 [L]
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.domain.com
AuthUserFile /home/intera/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/intera/public_html/_vti_pvt/service.grp
RedirectMatch permanent ^/webmail$ http://http://mail.google.com/hosted/domain.com www.domain.com/hotsite/
In this 'hotsite' folder, there's a .htaccess file containing the following code:
/hotsite/.htaccess:
RewriteEngine on
RewriteBase /
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ /folder/index.php
Now, when I access www.domain.com/hotsite/, my application loads fine. but when I try and access www.domain.com/hotsite/section/, it appears to ignore the .htaccess file and tries to access "section" as if it was a folder, returning a 404 error.
Any ideias why this is happening and what should I do to make it work?
Thanks =)
If the htaccess is inside the hotsite folder, then RewriteBase / needs to be RewriteBase /hotsite
Just in case; Note that the rewriterule, rewrites to /folder/index.php, and not /hotsite/folder/index.php
Hello i tried too much and i coudln't find a solution so i decided to ask here currently iam using wordpress website and my pages and posts link will be www.mydomain.com/postname and i want to make members user profile link like www.mydomain.com/user/profilename must redirect to profile.php?user=Username
Currently iam having this code in .htaccess:
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName sampcnc.com
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
So please help how to do this , Thanks in advance
i want to make members user profile link like www.mydomain.com/user/profilename must redirect to profile.php?user=Username
Before your wordpress rules # BEGIN WordPress, add these:
RewriteEngine On
RewriteRule ^/?user/(.*)$ /profile.php?user=$1 [L,QSA]
So when someone entes www.mydomain.com/user/profilename in their browser's URL address bar, they get served the content at /profile.php?user=profilename. You'll just have to make sure any links you generate look like the /user/profilename version.
i need your help please, because of .htacces file, when i put it on the server i get the Internal Server Error and when i delet it i can see the website onligne, but with may problems of links, title of links become links .html and of course after following it page not found ( normal because, the real link it's mysite/offers.php?id=
and this is a copy of .htacces :
IndexIgnore */.??* *~ *# */HEADER* */README* */_vti*
php_value post_max_size 96M
php_value upload_max_filesize 96M
php_value max_execution_time 0
php_value memory_limit 96M
# Changement d'extension
RewriteCond %{HTTP_HOST} !^www.mysite.com$
RewriteRule ^(.*) http://www.mysite.com/$1 [QSA,L,R=301]
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName mysite.com
AuthUserFile /home/larbi/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/larbi/public_html/_vti_pvt/service.grp
RewriteEngine on
RewriteRule ^([0-9]+)-(.*)-.*$ offres.php?lang=$2&id=2_$1 [L]
RewriteRule ^prestations.php$ offres.php?id=2_1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /erreur_404.html
waiitng youe answer please, thank you so much
There's nothing wrong with your htaccess file but make sure of these things:
Make sure you have mod_rewrite enabled. It should be a line in httpd.conf that looks something like:
LoadModule rewrite_module modules/mod_rewrite.so
Make sure there's a file /erreur_404.html that exists, if that file is missing, the rewrite engine will loop.
Additionally, make sure /offres.php exists, if that file is is missing, the rewrite engine will redirect to /erreur_404.html.
Just can't get rid of my url extensions.
I'm building a static site so all content is in HTML format and files have .html extensions.
I want to hide the .html extensions from users so my url would read websitename.com/about
I have modified the .htaccess file where my site is hosted, it now looks like this
# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName boldfacedesign.co.uk
AuthUserFile /home/boldface/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/boldface/public_html/_vti_pvt/service.grp
RewriteBase /
RewriteEngine on
RewriteCond %{RQUEST_FILENAME} !-d
RewriteCond %{RQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1html [L,QSA]
At present this just isn't working.
As you can see this file is in the public_html folder, is that the correct place for it?
Or is there something else I need to do to enable the rewrite rule to take effect?
Or do I simply need to be patient and wait a day for the changes to take affect?
I've been googling this for hours now and I'm getting nowhere.
Not sure if these are typos or what, but your rewrite rules should probably look more like:
RewriteBase /
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html [L,QSA]
Or if you have trailing slashes, the last line should be:
RewriteRule ^(.*?)/?$ $1.html [L,QSA]
The story behind...
Ok, I was experimenting things with my netbook...without having backup files. Yes, I'm a moron :D
The Problem
I have this .htaccess file in my userdir which was working properly before I screwed up my partion:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /~dierre/DierReLabS/
RewriteRule ^(tutorials|me|not-found|add)$ $1/ [R=301,L]
RewriteRule ^me/$ me.php [L]
RewriteRule ^style/$ style.css [L]
RewriteRule ^logo/$ logo2.png [L]
RewriteRule ^add/$ add.php [L]
RewriteRule ^tutorials/$ tutorials.php [L]
RewriteRule ^tutorial/([a-zA-Z0-9\-]+)/$ tutorial.php?tut=$1 [L]
RewriteRule ^not-found/$ 404.php [L]
# This is a real directory...
RewriteCond %{REQUEST_FILENAME} -f [OR]
# Or it's a real file...
RewriteCond %{REQUEST_FILENAME} -d
# And it's not not-found/...
RewriteCond $0 !=not-found/
# And it's not the root
RewriteCond $0 !=""
# And it's not any of the above due to an internal redirect...
RewriteCond %{ENV:REDIRECT_STATUS} ^$
# So cause a 404 response (you could redirect to 404.php if you want)
RewriteRule ^.*$ - [R=404,L]
ErrorDocument 404 /~dierre/DierReLabS/not-found/
In the userdir this .htaccess does not work properly with the default parameters in userdir.conf. I do not have anymore that configuration. The current configuration is:
<IfModule mod_userdir.c>
UserDir public_html
UserDir disabled root
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
</IfModule>
I really can't recall what I did. Can you help me?
Thanks God for forsaken laptop! I've started today my Thinkpad and it was there the configuration with a non-updated version of the site.
<IfModule mod_userdir.c>
UserDir public_html
UserDir disabled root
<Directory /home/*/public_html>
#AllowOverride FileInfo AuthConfig Limit Indexes
AllowOverride All
#Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Options Indexes FollowSymLinks
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
</IfModule>