406 Not Acceptable on MacOSX Maverick - osx-mavericks

I am really new for Mac OSX, I had develop the web based application while communicate with another server.
Tried before on Linux, the scripts works well, but when I tried to implemented on Mac OSX server I got the error:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>406 Not Acceptable</title>
</head><body>
<h1>Not Acceptable</h1>
Tried using .htaccess
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
and this:
<IfModule mod_security2.c>
SecRuleEngine Off
</IfModule>
I tried to testing this on Linux environtment, and works.
Anyone know how to fix this on Mac?
Thanks

Related

DocC index shows a blank page when using MAMP

I am trying to perform a POC for the company I work to see the potential value we can get by using DocC in our project.
Before my development, I saw the 4 videos related to DocC from WWDC 2021, visit Apple developer site and read some pages and blogs to gather some information and thoughts.
For my development, I started using MAMP on my dev machine before pushing the work to the server.
So far, I think I have done all the necessary steps to host the doccarchive on the website. However, I wonder if I have missed something as my index.html looks blank.
The code I used is:
index.html (main)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DocC POC</title>
</head>
<body>
<h2>Welcome</h2>
<button onclick="location.href = 'documentation/index.html';" id="myButton" class="float-left submit-button" >Read data framwework documentation</button>
</body>
</html>
.htaccess
# Enable custom routing.
RewriteEngine On
# Route documentation and tutorial pages.
RewriteRule ^(documentation|tutorials)\/.*$ Data.doccarchive/index.html [L]
# Route files and data for the documentation archive.
#
# If the file path doesn't exist in the website's root ...
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# ... route the request to that file path with the documentation archive.
RewriteRule .* Data.doccarchive/$0 [L]
File structure
Picture prooving that the doccarchive is not empty
Picture of blank page
Any ideas??
I was able to try it on github pages and was showing blank until I used the path {base path}/documentation/{project name}
so in your case try to replace index.html with your project name

C:/xampp/htdocs/.htaccess: RewriteRule: bad flag delimiters - XAMPP/Windows

I installed XAMPP on my Windows PC.
I created a simple static pages and created .htaccess file in c:\xampp\htdocs.
.htaccess file content is:
RewriteEngine On
RewriteRule ^about-us$ about-us.php [L]
I am getting 404 for the below page:
http://localhost/mysite/about-us/
Anyone help me to identify whats wrong with the .htaccess file.
It worked when I moved my .htaccess file from htdocs to htdocs/mysite

mod_rewrite - redirect to a different url based on existence of x_wap_profile header

We have a desktop and a mobile version of our webapp.
The desktop url is more prominent and so we would like to redirect the user to the mobile version in case the request is for the desktop url from a mobile device.
In the apache config we have the mod_rewrite module
and my config at present looks like this
<IfModule mod_rewrite>
RewriteEngine On
RewriteCond %{x-wap-profile} ^https?://
RewriteRule ^/(.*) http://google.com [L,R]
</IfModule>
At this point this is the only rewrite rule that we have so I'm not sure if L is required because this is the first and last rule anyway.
I have just indicated redirection to google.com for testing purposes
I'm not sure if my condition check is right.I couldn't figure out how to check for existence of a header.Is that what is wrong?If yes,please let me know how to specify the RewriteCond
How I'm Testing?
I'm testing from a Firefox browser and using the Modify headers plugin to simulate the mobile request.I'm adding the x_wap_profile header.
However I don't see any redirect happening with this config.Can you please let me know where I'm going wrong?I would also appreciate if there is any logging that can be introduced here to verify if this rule is being trigerred.I don't see any errors though with the current modified config.
To check for an arbitrary header in mod_rewrite (i.e. a header not in this list), the syntax is:
RewriteCond %{HTTP:x-wap-profile}
This one seems to work:
RewriteEngine On
RewriteCond %{HTTP:x-wap-profile} ^.+
RewriteRule .* http://google.com [L,R]
piotrek#piotrek-Vostro-2520:~/vhosts/localhost$ curl http://localhost/
OKOK
piotrek#piotrek-Vostro-2520:~/vhosts/localhost$ curl -H 'x-wap-profile: abcd' http://localhost/
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved here.</p>
<hr>
<address>Apache/2.4.6 (Ubuntu) Server at localhost Port 80</address>
</body></html>
Change it to make it work for https inside header.
Docs here: http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritecond in section Other things you should be aware of:.

Apache see index as index.php

I have a small problem: Apche on my Mac OS X 10.8.1 sees /index and /index.php as same file. That is when referring to the /index it load index.php like some RewriteRule. DirectoryIndex index.html as default.
P.S.
Also is other topic, but with no working solution for me.
This is a function of MultiViews. You can disable it in your .htaccess like this:
Options -MultiViews

apache returns 404 even after mod_rewrite

I am using apache mod_rewrite for the first time.
I want http://example.com/anything/after/this to be transformed as http://example.com/storage-server/index.php?id=/anything/after/this
I have written following lines to apache's httpd.conf file
RewriteRule ^/(.*) /storage-server/index.php?id=$1
But I am getting 404 message saying that this file doesn't exist. I have enabled the mod_rewrite so that is not issue. I think something is preventing this URL to be rewritten....
any idea???
UPDATE::
All things are solved. All above mentioned settings should be entered into /etc/apache2/sites-enables/000-default file..
SOLVED
UPDATE:::
I have just tried extremely simple rewrite rule. I have created test1.html and test2.html files in my web server root. Then i wrote following rule in my httpd.conf file
RewriteRule ^test1\.html$ test2.html
When i visit test1.html the browser still shows test1.html file instead of test2.html/ Please help.. I am having this trouble since last 3 days... sick of it ..:-(
You write that you want it to redirect to http://example.com/index.php?id=/anything/after/this but you're redirecting to http://example.com/storage-server/index.php?id=/anything/after/this. Could that be it?
ensure that the following line in your Apache's httpd.conf is not commented out
LoadModule rewrite_module modules/mod_rewrite.so

Resources