So I'm trying to get mod_rewrite to work, using Apache2.2 on windows 7
I'm running it as a local server.
All sites are accessed at http://localhost/
It's not working?
I created a simple .htaccess file and it won't work.
in the httpd.conf I changed it to
Options All
AllowOverride ALL
Whats the problem?
Try writing garbage in your .htaccess file. This should cause a 5xx error message. If it does not then your AllowOverride All is at the wrong place in your config.
I would also suggest adding a (name based) virtualhost to keep your configuration at one place instead of modifying the defaults.
Just want to add to the above which is correct, I was also pulling my hair on a non-working .htaccess. After hours of testing and troubleshooting it turned out that, even though my Sublime Text 2 was set to UTF-8, somehow it was still carrying over hidden special characters that were the root cause of my problem. After copying & pasting .htaccess' contents into vim editor, removing those weird characters, then resaving things started working as should.
Related
I had my websites set up so that if someone types in a URL with upper case letters and/or underscores, like this - MySite/topics/United_States - it will automatically default to mysite/topics/united-states (lower case and dashes instead of underscores).
I've been through some website crashes, moves and reorganization, and I just discovered this feature is no longer working. I haven't been able to access my online httpd.conf file.
However, I think I discovered a way to do it with C-Panel...
Service Configuration > Apache Configuration > Include Editor > Post VirtualHost Include
"Entering information in this text area will add content to the Apache configuration file (httpd.conf) right after the last VirtualHost entry.
"I wish to edit the Post VirtualHost configuration include file for:"
I selected 2.4.18, and it opens a box where I can type in my code. Above the box it says Filename: post_virtualhost_2.con
And this is the code I want to paste in the box:
RewriteRule (.?[A-Z]+.) /${tolower:$1} [R]
Which brings me to my question. Before I do this I want to make sure I'm not doing something that's going to wreck my site. Does it sound like I'm doing this the right way? And if I somehow mess up this file or paste in the wrong code, how can I fix it?
Have you tried to use this rewrite rule in the .htaccess file of a single cPanel account on the server and test it? It will cause a lot less damage in case it does not work and will be easier to revert (just delete the line).
Please make sure that if you add it in an .htaccess, you also start with:
RewriteEngine On
and then add your rewrite rule.
If you decide to go and edit the global Apache configuration, you should log in the server via SSH and make a copy of the file you are editing:
/usr/local/apache/conf/includes/post_virtualhost_2.conf
If this breaks your site, you can just restore the original file or remove the changes you made and restart Apache, this should fix it.
So I am at my wits end with this problem of trying to configure a simple Apache Web Server for one of my assignments. For some reason my changes to index.html are no longer being read, even though I got it to change previously.
I had this problem previously, where I would change index.html and it would still show the default "It works!" message. It ended up that, because my file extensions weren't shown, I had accidentally named the file index.html.html, and so obviously it wasn't locating it.
However, now that my file extensions are showing, I am having this problem again (the last fiasco was about a week or two ago). I tried changing the contents of index.html again, just a simple text change, and it is still loading my previous page. I have tried restarting Apache through Administrative Tools > Services since the Apache and httpd commands in the command line won't work for me. I even tried deleting the index.html file and leaving htdocs empty and it's still displaying my old web page!!!
I have no idea why it's doing this and I can't find any other answers. I checked my DirectoryRoot and DirectoryIndex values and they all point to index.html (and plus, I haven't touched httpd.conf since installation anyways). Running Windows 8.1. Any help greatly appreciated.
Modern Windows has a feature that copies some files when non-administrator edit them. You see the changes, but the service doesn't. Try editing your files as Administrator (not just someone with Administrator group privileges)
I'm using the Zend Framework to develop an application on a linux host, and for some reason when I try to go to localhost/index it gives me what looks like a standard Apache 404 error. But when I go to localhost/Index it works. I can also go to localhost/admin and it will work with no problem. For some reason it seems that my index controller doesn't want to work. How can I make it to where localhost/index works?
My .htaccess file seems fine and has the correct rewrite rules in it.
I had a similar problem and tracked it back to Options MultiViews on Apache. If you're using a vhost, check there. If I recall, MultiViews will try to find other files with a similar name if the requested file is not found. If it's on, try disabling it and see what happens.
I am using WHM/cPanel to manage web hosting and wondering how to remove the "cpanel, whm, webmail" ServerAlias. For example, I DO NOT want anyone to do this {HTTP_HOST}/cpanel in order to get to their cPanel.
These rules are clearly defined in the httd.conf file which is located in
/usr/local/apache/conf
I have already tried to manually modify them and I got the following message:
# DO NOT EDIT. AUTOMATICALLY GENERATED. IF YOU NEED TO MAKE A CHANGE
PLEASE USE THE INCLUDE FILES.
Nothing really happened even though the file was successfully saved. Users are still able to use these unwanted aliases. What should I do to effectively make the change?
Have you restarted Apache?
service httpd graceful
.. or you can do it through WHM.
I'm having trouble with my Apache Web Server. I have a folder (htdocs\images) where I have a number of images already in place. I can browse them and see them on my web server (and access them via HTML). I added a new image in there today, and went to browse to it, and it can't be found. I double and triple checked the path and everything. I even restarted Apache and that didn't seem to help.
I'm really confused as to what's going on here. Anybody have any suggestions?
Thank you.
Edit I just turned on the ability for the images directory to be listed, browsed to it (http://127.0.0.1/images/) and I was able to see all the previous images that were in the folder, but not the new one.
Turn directory indexes on for htdocs\images, remove (or move out of the way) any index.* files, and point your browser at http://yoursite/images/
That should give you a full listing of files in that directory. If the file you're looking for isn't there, then Apache is looking at a different directory than you think it is. You'll have to search your httpd.conf for clues -- DocumentRoot, Alias, AliasMatch, Redirect, RedirectMatch, RewriteRule -- there are probably dozens of apache directives that could be causing the web server to get its documents from somewhere other than where you think it's looking.
make sure the caSE and spelling are 100% correct.
There is not magic in programming (some may disagree:), so look for silly errors. Wrong server? Case of your letters? Wrong extension?
There's a chance it could be due to the cookies stored on your device. I would delete all cookies to the website you're working on before you refresh again