XAMPP only loads one of my pages - html

When I access my website using localhost/myfiles/index.html, my index file opens fine but if I want to click on the other pages/buttons, it doesn't work. The only way to open the other pages is if I do it manually by using localhost/myfiles/news.html and then only that pages works so I can't basically navigate my way around the website.
I had my website online yesterday and I know it works because I used it. I plan on making changes to my website and I need to be able to test them offline before I upload them to my online server. I just want to be able to navigate my site offline using XAMPP the same way that I would if it was uploaded on GoDaddy.
EDIT:
This is my .htaccess file
RewriteBase /
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
Any suggestions ?

Seems you have .htaccess at your root and its not working properly.
in httpd-vhosts.conf
<Directory "PATH TO YOUR PROJECT ROOT">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Or update your .htaccess file
Without seeing your system it's hard to tell what's wrong but try the following (comment answer if these didn't work WITH log error messages)
[STOP your Apache server instance. Ensure it's not running!]
1) move apache server/install to a folder that has no long file names and spaces
2) check httpd.conf in install\conf folder and look for AccessFileName. If it's .htaccess change it to a file name windows accepts (e.g. conf.htaccess)
3) double-check that your htaccess file gets read: add some uninterpretable garbage to it and start server: you should get an Error 500. If you don't, file is not getting read, re-visit httpd.conf file (if that looks OK, check if this is the only file which defines htaccess and it's location and it does at one place -within the file- only; also check if both httpd.conf and htaccess files are accessible: not encrypted, file access rights are not limited, drive/path available -and no long folder path and file names-)
STOP Apache again, then go on:
4) If you have IIS too on your system, stop it (uninstall it too if you can) from services.msc
5) Add the following to the top of your valid htaccess file:
RewriteEngine On
RewriteLog "/path/logs/rewrite.log" #make sure path is there!
RewriteLogLevel 9
6) Empty your [apache]\logs folder (if you use another folder, then that one :)
7) Check the following entries are set and correct:
Action application/x-httpd-php "c:/your-php5-path/php-cgi.exe"
LoadModule php5_module "c:/your-php5-path/php5apache2.dll"
LoadModule rewrite_module modules/mod_rewrite.so
Avoid long path names and spaces in folder names for phpX install too!
8) START apache server
You can do all the steps above or go one-by-one, your call. But at the end of the day make sure you tried everything above!
If system still blows up and you can't fix it, copy&paste error message(s) from log folder for further assistance

Related

Deployed laravel app, only homepage working

I have recently finished a website for a customer, the site works great locally. Currently only the homepage is working. However all links return a 500 server error.
This is 1and1, and I haven't heard many good things about it.
Currently I have the laravel folders for my app within a folder called webapp.
the domain name points to webapp/public.
I have also added the following line to my htaccess to get it to work
RewriteRule ^ /home.php [L]
which works for the homepage. I don't know much about the htaccess file, so I've messed around with a few other options such as
RewriteRule ^ /folios.php [L]
as well which is one of the links in my site, however this doesn't work.
My routes currently work like this
Route::get('/folios', 'AlbumsController#index');
However they return 500 server error
Change the line in the ".htaccess" file in the root folder from RewriteRule ^ index.php [L] to
RewriteRule ^ /index.php [L]
My suspicion is that you need to update the paths contained within public/index.php
Check out this article for instructions: https://medium.com/#Bohr/deploy-laravel-application-on-shared-hosting-godaddy-953758dc57ac
Did you run composer install on the server or copy out the vendor directory? You may also want to check that your htaccess file in the public directory contains the directives that are required (https://github.com/laravel/laravel/blob/master/public/.htaccess).
I did not realize that the server generated a new .htaccess file within the /webapp/ folder where I pointed the domain; I was editing the wrong .htaccess file

Whatever I do, .htaccess won't do the job

Working with .htacess file has always been a very frustrating experience for me. Someone please help.
This is what I want to achieve:
I am running Ubuntu 14.04.
Redirect my entire site (example.com) to a maintenance.html page.
Block everybody else except one IP, for example, I need to allow only 123.456.789.0
Here are my files:
Location of my index.html is /var/www/html
Location of my maintenance.html is /var/www/html
Location of my .htaccess file is /var/www/html
Contents of My .htaccess file:
#Rewrite to www
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com[nc]
RewriteRule ^(.*)$ http://www.example.com/$1 [r=301,nc]
#301 Redirect Old File
Redirect 301 /index.html /maintenance.html
#Block users by IP
order allow,deny
deny from all
allow from 123.456.789.0
Please help me understand:
Is the location of each of the above files right? In what cases, the
page ends up in 500 internal server error?
What changes should I make in
/etc/apache2/apache.conf
/etc/apache2/sites-enabled/000-default.conf OR
/etc/apache2/sites-available/000-default.conf
Is is necessary to run a2enmod rewrite?
Should I add <IfModule mod_rewrite.c> and </IfModule> as header and footer in any of the above config files?
Sorry for too many questions, but I really want know it all this time.
Thanks in advance.
Is the location of each of the above files right? In what cases, the
page ends up in 500 internal server error?
A "500 Internal Server Error" message means there's an error and you're expected to check the server logs for the exact details. Apache will not display the error message to be seen by everyone.
What changes should I make
It depends on what the problem is. If the problem is "500 Internal Server Error" that means that we still don't know what the problem is.
Is is necessary to run a2enmod rewrite?
That command enables mod_rewrite. You need to enable it if it isn't enabled. You don't need to enable it if it's already enabled.
It's worth noting that this command is not part of official Apache distribution. Some Linux distros (namely Debian and derivatives) change third-party packages to match their configuration preferences, as in this case.
Should I add <IfModule mod_rewrite.c> and </IfModule> as header
and footer in any of the above config files?
As documentation explains, this block can be used to ignore directives when a given module is not installed. This can be useful for configuration templates to be distributed and optional features. In your case, it'll silently ignore your code if mod_rewrite is not available—you don't want that.
Last but not least:
order allow,deny
deny from all
allow from 123.456.789.0
... belongs to the old (and really hard to understand) Apache/2.2 syntax. If you are using Apache/2.4* you may want to try Require.
(*) Some distros hate bundling recent software but 2.4 has been around for several years
Thanks to #OlafDietsche and #ÁlvaroGonzález for this quick help. I am keeping their suggestions here so somebody like me will find it useful.
The problem is with my goals, not with the syntax. With their comments and answers, I came to know that my 2 goals were mutually contradicting ones.
I configured .htaccess to do both page-redirection and IP block. But if I am blocking (almost) everybody from accessing the site, page redirection makes no sense.
The required configuration in .htaccess is:
#Rewrite to www
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com[nc]
RewriteRule ^(.*)$ http://www.example.com/$1 [r=301,nc]
#301 Redirect Old File
Redirect 301 /index.html /maintenance.html

Apache (.htaccess and mod_rewrite) url rewrite/redirection not working :404 page not found error

I just installed the mod_rewrite module on my server and am trying to test it out by directing all urls to a webpage good.html
this is my .htaccess file:
RewriteEngine on
RewriteRule .* good.html
however I keep getting a 404 page not found message?
I've checked my httpd.conf file and ran phpinfo() and the module seems to have loaded fine. Any ideas?
Also I am working on apache 2.0.58
I've got the same problem. Everything looks fine, but I had to change two configurations on httpd.conf (or any other site config loaded).
Change to:
Options FollowSymLinks
AllowOverride All
These options are inside Directory tag. If you do not set AllowOverride All, .htaccess does not take effect.
Eder

Default 403 page not showing up

I recently set up a few new folders in my server, but I wanted to turn them and all their subfolders forbidden. So, using .htaccess, I simply used deny from all. The issue here is that it's redirecting me to my host's 404 page (which has a lot of advertisements, join us, it looks like their front page), instead of the regular 403 page.
This seems like a very trivial question, but I couldn't find the answer anywhere. How do I get everything in that folder to use the classic 403 page, being this:
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<h1>Forbidden</h1>
<p>You don't have permission to access /example/example2/exampleC/
on this server.</p>
</head>
</html>
Which changes depending on which folder I just entered. If In /example/ I have /example1/, /example2/ and /example3/, how do I make it so that if I enter /example1/, I get a 403 page that says I don't have access to /example/example1/?
This may seem a bit overly (needlessly) complicated.
let's debug step by step
for debugging please follow these steps
Rename in your DocumentRoot .htaccess to .htaccess_safe
Create a folder in DocumentRoot "test"
Insert in that folder a .htaccess with following content
RewriteEngine On
RewriteRule ^(.*)$ http://google.de [L,R=301]
Open in your Browser http://example.com/test/ [you should redirect to google]
If this works ... read more under step 5.
If not ... put this .htaccess in the DocumentRoot Folder and open in your Browser http://example.com/test/ if this doesn't run too, stop debugging. If it works, your Server isn't able to exec .htaccess in subfolders (check for that the rights of the .htaccess file on your server group, user and chmod .....
(5) Rename your .htaccess_safe back to .htaccess and change line 12 RewriteRule ^$ http://www.avatarchan.net/site/ [R=301,L] to #RewriteRule ^$ http://www.avatarchan.net/site/ [R=301,L] and try again

How to setup Mercurial central repository on shared hosting

I am trying to setup a central repository with shared hosting. I read all the way through this tutorial https://www.mercurial-scm.org/wiki/PublishingRepositories to no avail. Here are the steps I took.
1. Copy hgwebdir.cgi file to directory at http://url.com/central_repository/hgwebdir.cgi
2. Added the following information to the hgweb.config file and copied it to same place.
[paths]
projectname = /home/username/central_repository/projectname
[web]
baseurl = /hg
3. Added the following to an htaccess file and copied it to the same place
# Taken from http://www.pmwiki.org/wiki/Cookbook/CleanUrls#samedir
# Used at http://ggap.sf.net/hg/
Options +ExecCGI
RewriteEngine On
#write base depending on where the base url lives
RewriteBase /hg
RewriteRule ^$ hgwebdir.cgi [L]
# Send requests for files that exist to those files.
RewriteCond %{REQUEST_FILENAME} !-f
# Send requests for directories that exist to those directories.
RewriteCond %{REQUEST_FILENAME} !-d
# Send requests to hgwebdir.cgi, appending the rest of url.
RewriteRule (.*) hgwebdir.cgi/$1 [QSA,L]
4. Uploaded the repository without the working directory to /home/user/central_repository/projectname
5. Tried to clone the repository to my computer using the folloing destination path: http://url.com/hg/projectname
After going through these steps I get a 404: Not Found error.
However if I change the destination path to http://url.com/central_repository/projectname It acts like it found the repository, It tells me it found the changesets, and it was adding the changesets and manifests, but then it says "transaction abort! HTTP Error 500: Internal Server Error.
Thanks for any help! Metropolis
EDIT
Also whenever I try to put the ScriptAlias, Alias, the previous content, or the following content into an htaccess file, I get a 500 internal server error.
<Directory "/home/username/central_repository/projectname">
DirectoryIndex index.cgi
AddHandler cgi-script .cgi
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
In fact, if I take everything out of the hgwebdir.cgi file except for the following, I get a 500 error.
#!/usr/bin/env python
#
# An example CGI script to export multiple hgweb repos, edit as necessary
I even tried putting this file in the cgi-bin directory and I am still getting the error. I also was sure to put the file permissions to 755. Is it possible I can not run python files on this server?
If the .cgi extension isn't already mapped to the cgi handler in your host's Apache config you either need a ScriptAlias or AddHandler line for your hgwebdir.cgi script. Actually you can get rid of all that unnecessary RewriteCond and RewriteRule stuff if you just do a single ScriptAlias:
ScriptAlias /hg /home/username/central_repository/hgwebdir.cgi
Also the repo has a /home/user/central_repository/projectname/.hg directory, right? Putting the contents of the .hg directly into projectname would be wrong.
Lastly, try visiting it with your browser, not using clone. What do you see at http://ggap.sf.net/hg/ ? What is in the apache access and error logs? Hopefully you have access to the error log because that always has the best output for debugging this stuff.
This could also be a permission error.
I just encountered a similar situation where I had created a repository in my usual place where apache picks it up via hgwebcgi. I could clone that repository locally (not going via webserver), but not from a remote client, so I knew it was not a hg error as such.
Turned out the problem was that my repository was owned by the user I created it with, with no read/write access given to apache.
Running
chown -R apache:apache <repo>
did the trick. (I exclusive access these repositories via the web, so this seems ok, otherwise come up with a solution that will allow apache access without owning it)
I had the same problem. I needed to set up a Mercurial server on a shared host to which I do not have root/shell access. I followed this guide and with surprisingly little frustration, got it to work:
http://javadocs.wordpress.com/2010/04/27/set-up-mercurial-1-5-1-on-a-shared-host-simplified/
http://wiki.dreamhost.com/Mercurial
This has worked for me in the past.