Getting mod_rewrite to work on OSX Lion - macos

I'm trying to get mod_rewrite to work on OSX Lion.
By default, Lion loads the mod_rewrite module.
In my /etc/apache2/users/neil.conf I include the following:
<Directory "/Users/neil/Sites/">
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
But whenever I visit a page locally, I get the message: The requested URL /some-page/ was not found on this server.

Can you access the page if you visit domain.com/index.php/some-page instead of domain.com/some-page?
If so, this could be an htaccess issue. Consider checking out EE's documentation on using an htaccess file to remove index.php from the URLs

Related

Apache stop webdav directory listing on windows

I'm working on a server which has to serve a few files publically via WebDav. The public availability and WebDav is a must have, so I can't just change them. Windows support (sadly) is another must thing...
It would be great if I could disable directory listing, so the person who I give the webdav link would only be able to either guess the link or use only the one I gave.
In default case it's quite easy to disable directory listing, and in the browser the current configuration perfectly stops dir listing, but when I open it via windows explorer, I can easily see the whole directory and its content. My current config is:
<VirtualHost *>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/web1/web/
<Directory /var/www/web1/web/>
Options MultiViews
AllowOverride None
Order allow,deny
allow from all
<LimitExcept GET PROPFIND>
Require valid-user
</LimitExcept>
</Directory>
Alias /v1 /var/www/web1/web
<Location /v1>
DAV On
AuthName "webdav"
</Location>
</VirtualHost>
If I wont allow PROPFIND method, windows thinks that the host is unavailable (unsure if linux can access it, that's not my target).
Is it possible to stop directory listing on windows? For me it seems the PROPFIND is what causes this, but I'm unsure if I can somehow bypass this problem. Do you have any idea how should I modify my config file?
I know this question is old, but in your VirtualHost file (the file in /etc/apache2/sites-available/[yoursite].conf), you need to add something. This is in your directory tag. Supply it with DirectoryIndex disabled. Like this
<Directory [yourdirectory]>
(...)
DirectoryIndex disabled
</Directory>
Sincerly, Chris Fowl

Unable to connect to local host after modifying Apache config file (Windows)

I have downloaded the Apache HTTP server for windows and installed it. I have created a test html file under C:/mobileTraining/core/workspace/TestProject
I then added a permissions directory tag in the httpd.conf file, so that it now looks like the following:
<Directory />
AllowOverride none
Require all denied
</Directory>
<Directory C:/mobileTraining/core/workspace>
Order allow,deny
Allow from all
</Directory>
Alias /TestProject C:/mobileTraining/core/workspace/TestProject
I've tried this with and without the first Directory tag, which was there already.
When I then save these changes and go to http://localhost/TestProject/TestPage.html in my browser (I've tried Firefox and Chrome), I get a connection error. This is from Chrome:
This webpage is not available
Google Chrome's connection attempt to localhost was rejected. The website may be down, or your network may not be properly configured.
Error code: ERR_CONNECTION_REFUSED
Is there something blindingly obvious in my set-up that I've missed?
Thanks
Try to access your site by including the port the default setup for this is 8080
http://localhost:8080/TestProject/TestPage.html
First, make sure you are able to access http://localhost/
Also, i suppose you have TestPage.html in C:/mobileTraining/core/workspace/TestProject
You are setting permissions for C:/mobileTraining/core/workspace ?
As mentioned in Example here . Try below.
Alias /TestProject "C:/mobileTraining/core/workspace/TestProject"
<Directory "C:/mobileTraining/core/workspace/TestProject">
Order allow,deny
Allow from all
</Directory>
Good Luck!

Changing Magento domain breaks URL rewrites

I'm just launching my first Magento store (on CentOS & Apache) and I've switched over from my setup subdomain - http://prelive.mydomain.com (where everything worked fine, with url rewriting enabled & working) - to the live subdomain http://www.mydomain.com, basically just by doing the following:
clearing caches via the admin interface
updating the secure & unsecure base urls in the db
UPDATE core_config_data SET value = 'http://www.mydomain.co.uk/' WHERE path = 'web/unsecure/base_url';
UPDATE core_config_data SET value = 'https://www.mydomain.co.uk/' WHERE path = 'web/secure/base_url';
moving the entire site file system from /var/www/html/prelive to /var/www/html/www (I tried copying but it caused all sorts of permission problems which I'll figure out later!)
manually editing the media base path in var/resource_config.json
updating my virtual host like this:
<VirtualHost *:80>
DocumentRoot /var/www/html/www
ServerName www.mydomain.co.uk
ServerAlias www.mydomain.co.uk
ErrorLog logs/www.mydomain.co.uk-error_log
</VirtualHost>
editing the base .htaccess file like this ()
SetEnvIf Host www\.mydomain.co.uk MAGE_RUN_CODE=angling_r_en
SetEnvIf Host www\.mydomain.co.uk MAGE_RUN_TYPE=store
SetEnvIf Host ^mydomain.co.uk MAGE_RUN_CODE=angling_r_en
SetEnvIf Host ^.mydomain.co.uk MAGE_RUN_TYPE=store
And it almost works... but the url rewriting is broken. I can see the site on http://www.mydomain.com but navigating to subpages gets a 404 (e.g. http://www.mydomain.com/path/to/product.html ), unless I specifically alter the URL to point through index.php like this http://www.mydomain.com/index.php/path/to/product.html or http://www.mydomain.com/index.php/admin
For reference, in .htaccess I also have (left unchanged during the switch of subdomain):
RewriteBase /
and
RewriteRule .* index.php [L]
Any thoughts on what I forgot?
Many thanks
Ben
Most likely you need to reindex the catalog URL rewrites to incorporate your new URL changes! See System > Index Management and reindex the Catalog URL Rewrites.
Ok - so the problem was on the server all along, not Magento...
Basically rewrites weren't working because I needed this in both my VirtualHost container in both both httpd.conf and ssl.conf:
<Directory /var/www/html/www>
AllowOverride All
</Directory>
What I still don't understand is how it worked on the old location (which definitely didn't have this) and not the new one... but it works just the same as before now, with "Use Web Server Rewrites" turned on in System > Configuration > Web, creating "clean" urls which are rewritten through index.php by mod_rewrite.

Enable directory/file listing in XAMPP

How to enable directory and file listing in XAMPP ? In WAMP it is by default enabled.
My Xampp httpd.conf already had the Indexes option under the xampp directory entry
Removing all the default #comment lines, it looks like this:
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
But, I have my local root mapped to a different directory, outside of 'htdocs', (as per this post Make XAMPP/Apache serve file outside of htdocs ) so to enable this for all directories, I had to find the entry just above that, and add the word "Indexes" to it.
<Directory />
Options FollowSymLinks Indexes
AllowOverride None
Order deny,allow
Deny from all
</Directory>
Note I would never enable this for all directories on a production server, but locally it is quite useful.
Just delete or rename index.html and index.php files
There is a XAMPP Directory Browsing UI app, that will help you to browse projects inside htdocs in XAMPP.
Open apache/conf/httpd.conf and search for Indexes in httpd.conf
And comment complete line like this:
#Options Indexes FollowSymLinks Includes ExecCGI
#Options - Indexes FollowSymLinks Includes ExecCGI
Uncommenting First will enable the indexing of directories.
Uncommenting Second will disable indexing of directories
Removing the comment will enable the Directory/file listing of hosted path.
Rename the 'index.php' file that sits in your htdocs folder to something like 'MODIFIED_index.php' (if you want to be able to revert to it later) - this index.php file is only used to point to xampp's admin controls that are found in 'localhost/xampp/' anyway.

codeigniter localhost setup 404 page not found error

I have a localhost setup(i use apache's virtualhost setup) for a site I am working on with codeigniter. I use SVN for the site.
I decided to change the localhost-domain name and the root-folder name(this is the folder from within which I check out SVN) to which the localhost-domain points.
To show a better picture, I changed;
sledge-vicky.localhost to hammer-vicky.localhost
Changed the document-root's name from "sledge" to "hammer". Have changed the document root,directory paths in the virtualhost setup too;
<VirtualHost hammer-vicky.localhost>
DocumentRoot D:\xampp\htdocs\vicky\projects\hammer
ServerName hammer-vicky.localhost
<Directory "D:\xampp\htdocs\vicky\projects\hammer">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Have set the domain-name in windows' hosts file. Have set/changed the base-url and database settings in config.php and database.php too(I use environment dir; _environment/vicky/config.php, _environment/vicky/database.php ).
In the code where we switch to the required app-environment, I have set the code to switch to my app-environment too.
http://sledge-vicky.localhost/ was working fine.
After the local-domain name and root-folder name change, accessing http://hammer-vicky.localhost/ throws a '404 page not found error'.
Any idea what could be wrong?.
My bad debugging. I got it working. I had to change other settings in some files specific to my environment (in my case, /application/config/_environment/...) that were related to some global settings(which in my case, others sharing the same svn-repository had changed).

Resources