Solving corruption in a .htaccess flle - .htaccess

I received a call from Go Daddy indicating that my site had been hacked and the .htaccess file is now an issue.
The code in my .htaccess file is as follows
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} (google|yahoo|msn|aol|bing) [OR]
RewriteCond %{HTTP_REFERER} (google|yahoo|msn|aol|bing)
RewriteRule ^([^/]*)/$ /help-insideit.php?p=$1 [L]
AddType application/octet-stream .gdb .gpx
Could someone advise me as to what could be corrupted?
Thanks
Howard

Related

htaccess does not convert sitemap.php to sitemap.xml

I already wrote yesterday about a problem with .htaccess that I solved thanks to the help of the user #RavinderSingh13. Now another small problem has arisen. I made sitemap.php which takes care of creating a sitemap by retrieving files from mysql database. Now I need to convert sitemap.php to sitemap.xml. But the .htaccess file does not allow me to find the requested file.
currently my .htaccess is this:
RewriteEngine ON
##Excluding Indexes and MultiViews options here.
Options -Indexes -MultiViews
DirectoryIndex home.php
##Rule for adding / at end of urls.
RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]
##Rules for non-existing pages to be served here.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ core.php [QSA,L]
i added this, but unfortunately it doesn't work
RewriteRule ^sitemap\.xml$ sitemap.php [L]
the sitemap.php file is located in the main root of the site. Could someone help me. Many thanks in advance.

How to solve sub-directory issue on hosting server

I hosted a website to a sub-directory in a hosting server.
But it is redirected to the main domain when I try to navigate to the sub-url of the website.
So, I added the .htaccess file to solve this problem.
The .htaccess file is the following.
RewriteEngine On
Options FollowSymLinks
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /#/$1 [L]
But I am getting the problem continuously.
Please let me know how I can solve it.
You can write the following contents to your .htaccess file.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /sub-directory/
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /sub-directory/index.html [L]
</IfModule>

Forbidden: Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request

Hi i have this folder on my server and it is clients/nannyshareaustralia and im using a codeigniter framework i already set up the config.php in the base url too. And im adding also for the htaccess file
RewriteEngine On
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|images|js|assets|css)
RewriteRule ^(.*)$ /clients/nannyshareaustralia/index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /clients/nannyshareaustralia/index.php?/$1 [L]
and when i run it to the browser this is what it goes
Forbidden
You don't have permission to access /clients/nannyshareaustralia on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
can someone help me figured this out? Any help is muchly appreciated
Please try this Following code write in your .htaccess file
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
RewriteEngine On
RewriteBase /clients/nannyshareaustralia
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|images|js|assets|css)
....
Added a RewriteBase rule to your .htaccess granting that mod_rewrite is enabled on your server.
note
If you access the directory like www.domain.com/clients/nannyshareaustralia you must add a RewriteBase to the .htaccess
But if a url/domain is pointed at the folder clients/nannyshareaustralia there is no need for the RewriteBase.

.htaccess is not working in my PHP MVC Framework

I am building my own PHP MVC framework from scratch on ubuntu. .htaccess file is not properly working in it. The folder structure and the .htaccess file content are as bellow.
Folder Structure
/MyMVCProject
/controllers
index.php
help.php
/libs
/modles
/views
.htaccess
index.php
.htaccess File content
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
When I type localh0st/MyMVCProject/help it gives me the following error.
Not Found
The requested URL /MyMVCProject/help was not found on this server.
Apache/2.2.22 (Ubuntu) Server at localh0st Port 80
And I'm sure I have enabled mod_rewrite.
Try to do it this way and from $_REQUEST array you can get url parameter and handle it in your index.php file.
Also for testing purpose add
echo <pre>;
print_r($_REQUEST);
echo </pre>;
at first lines of index.php
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/$ [NC]
RewriteRule ^(.*)$ /$1 [R=301,L]
</ifModule>
Try following RewriteRule (Copied and bit modified from Zend framework)
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*)$ index.php?url=$1 [QSA,NC,L]
I encountered the same thing, in my case the error was produced when I had a help.php file in the same directory. Don't know exactly why this happens...
You need to add:
RewriteBase /MyMVCProject
to your .htaccess file.

moved to dedicated virtual server, having trouble with .htaccess and permissions

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.

Resources