Apache giving pages as downloads rather than displaying them - apache

I just installed MediaWiki on a website and I am having some problems.
Whenever I go to "www.something.com/wikidir" the server gives me the PHP index file as an unnamed download instead of displaying it.
However, if I go to "www.something.com/wikidir/index.php" everything works as expected.
I'm not familiar with Apache and was wondering if someone could tell me how to fix this or point me in the right direction?
I'm using a LAMP stack and Mediawiki 1.7.1 (old I know).
In my .htacces file I have:
AddType application/x-httpd-php5 .php

Sounds like Apache (or PHP?) is serving the page as an application/octet-stream. You can check this by looking at the response headers on the non-index.php page. Firefox can do this using the Web Developer Toolbar > Information > View Response Headers. Look for "Content-Type"
Or, Does the non-index.php link work in IE? Does it go straight to download in Firefox (or another browser)? If the answer is yes, that's the problem.
How to fix it is more complex because there could be a bunch of different things that are causing this. My guess is that's it's an Apache config issue.
Edit
Check your .htaccess file. Make sure it's readable by Apache. I bet that's the issue.

Related

Apache server taking me to wrong URL but only for one link

The problem is quite confusing and I haven't been able to find a solution for this, I tried clearing caches, deleting HTACCESS file, still doesn't work.
I am using WAMP, and my project's homepage is in a directory, so the URL structure is:
localhost/project/shop/
There are other pages, contact.html, about.html etc etc.
I wanted to rewrite the URLs to show it without .html so I used the suggestions here:
How to remove .html from URL
Most of those didn't worked well, the problem was that it instead taking me to
localhost/project/shop/about
to me to
localhost/about
So I quit the idea of doing that on the localhost, so I removed the htaccess file and all other links worked fine, except for one contact.html, somehow it is cached and now going to localhost/project/shop/contact.html still takes redirects me to localhost/contact
If I open the localhost in an Incognito tab or if I add ?random=anything... the links works.
Any idea where I went wrong and how do I fix the issue?
Thanks.

Maintenance page on apache 7

I want to redirect to a maintenance page when my apache server is down.I tried through
htacess
and nothing worked.. Please direct me to some working blog.
Thanks...
The .htaccess file contains no executable program code to do some activities. If you want to show a webpage then you need a running webserver. If you have no one bad luck.
Take a look at this post about the technicel enviroment to reach your goal.
Edit: I found another post about this topic, though the same thing is the use of an additional webserver.

Why can I view .less file through ftp, but not http?

I'm wokring on a small website that I wouldlike to use Less CSS with, but I am having trouble getting the .less file to become available. If I go to the path on the server that the .less file is at through ftp, the file is there in the browser and I can read it. However, tag in the html is bringing me to a 404 page. If I manually type in the location through http it does not work. Why might this be happening?
Requests for static files return 404 error (IIS 6.0)
Im not sure if i understood you correct, but: LESS is not a replacement for CSS. You must generate a CSS-file from your LESS-file to be able to serve it to the browser.
The reason why you cant view it in your browser is because the web server har no MIME-type for LESS-files, and it shouldnt have.
You can however view it through FTP cause its a "normal" text document.
Edit: You can also process the .less-file with javascript, but thats not recommended for production use...

reloading webpage on safari downloads the page

I have a dynamic site I have made on PHP/MySQL and recently I have experienced a weird issue - sometimes (about once in four times) when I reload the active page the safari web browser (on a mac) automatically downloads the xxxx.php page rather than reloading it! I am trying to figure out what could be causing this, but i have no idea. Any suggestions?
The Content-Disposition HTTP Header is the only thing I can figure. Is there any way you can post something that we can test?
could it be with the .htaccess? I had a similar problem last month and I had to change some entries in my .htaccess, the shared server may have changed Apache's settings and it sopped working properly.

Apache redirection problem!

I am setting up a pre-built website built in php. The site was actually hosted on the linux server. Now I am trying to set it up on a Window machine with WAMP server. In this website almost every page request passes through a particular file called redirect(which is basically a php file without extension).
Now the problem is that when I inspected the configuration(httpd.conf, apache.conf,.htaccess, vhost.conf etc) of the apache server on the linux machine, I nowhere found the redirect rules for doing so. Neither mod_rewrite nor mod_alias rules for this redirection were found there. But is still redirects the request properly. I also noticed that Zend Framework library is there in the exact same directory where the redirect file is. This library is included in the include_path in php.ini. However, the web site is still not developed using Zend MVC and I have seen NO proof of ZEND being used there.
So I am really confused how this redirection is working there? I am unable to set up this on window machine without rewrite rules of mod_rewrite or mod_alias. Do you guys know any alternative of both the said modules for redirection?
I know the site is really weird, but i have to set it up. :)
Thanks in advance for your help.
I found the answer!!! :)
It was NGINX being used as Web Server Proxy before the request get passed to Apache daemon. So , there was NO redirect rules using mod_alias or mod_rewrite modules of Apache. The rule was written in configuration of NGINX.
It was really hard for me to find out this because the application was setup by somebody elsea and I had to fix that application. :)
Any how problem is resolved!!!!!! :)