MER
MER

Reputation: 1561

modx Revolution 2.3.x FURLs (Friendly URLs) not working on WAMP

I just recently moved my working modx site to my local system from the shared hosting server I have it on. On the server (LAMP) friendly URLs work fine. On my local computer (WAMP) friendly URLs produce a 404 error (though, as described by others the actual URL looks correct it just doesn't work). (To be specific my local is windows 8)
Server Apache ver= 2.2.29
Local Apache ver= 2.2.25 (there's no windows installer for 2.2.29)
PHP on server= 5.4
PHP on local= 5.4

Important: All other capabilities of modx seem to work just fine on my local. I did follow the official modx instructions for moving a revolution site from one place to another. In addition it might be valuable to point out that I added an entry in my hosts file to point the domain to localhost so the domain doesn't change... in that way anything that depends on the domain won't break when I move it from my local dev environment to the server.

What I've done to research:
Searched extensively on the internet & here on stackoverflow. So I have read through and tried various things from various articles on this site most notably including: This one This one & This one And also others that I didn't list. I've also read up more on the .htacces settings (though I am fairly familiar with Rewrites...).

What I've done to try to fix this:
-Modifications to my .htaccess
-Turning on and off all other settings in System Settings for FURL except the option to enable/disable FURLs (System_Settings->Area:Friendly URL)
-I've also verified that my installed apache modules are the same as those of my server/web host (specifically mod_rewrite but also others).
-I've also verified that my local PHP has a minimum of all the required extensions loading that are required or recommend for modx.

I'm still looking into this so there's a chance I might find an answer before I get much in the way of responses but I figure it's worth asking.

Thanks in advance.

UPDATE:
I've also tried moving all config settings out of the .htaccess (well except RewriteBase because putting it in httpd.conf causes an apache error that makes apache fail to load... it's designed to go in .htaccess files only). This also did not help. I also manually deleted everything out of the cache file, this also didn't help & last I turned friendly URLs off, verified that I could get to the resources, then turned them back on. This last effort also did not help.

Upvotes: 1

Views: 791

Answers (1)

MER
MER

Reputation: 1561

OK so after a lot of waiting for responses and a lot of reading up on friendly URLs & rewrites (though... I really couldn't see how the rewrite could be the problem because it worked on the server and didn't appear wrong in anyway), I found the answer to my problem.

Answer/Fix:
If you have a VirtualHost directive, Add this in a Directory directive like this:

<Directory "[same directory as virtual host]">

directive. If you do not have a VirtualHost directive then try adding one then adding the Directory directive.


Example

<VirtualHost *:80>
ServerName somedomain.com
DocumentRoot "D:/websitefiles/websitefilesforsomedomain"
</VirtualHost>
<Directory "D:/websitefiles/websitefilesforsomedomain">
Options +SymLinksIfOwnerMatch
RewriteEngine On
#####RwriteBase is removed because it isn't allowed in the httpd.conf instead it must be in a .htaccess file
#RewriteBase /

#NOTE: there were other things here that are part of the .htaccess provided by modx that I am using but they are not relevant to the friendly URLs
  
# The Friendly URLs part
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA,NC]
</Directory>

So my guesses are 1. that the above was necessary BECAUSE I already had a number of VirtualHost directives (this IS my development machine after all... I actually have a lot of VirtualHost directives...) OR 2. that because Windows has the different \ as part of paths (you know D:\websitefiles\ instead of /var/www/), that the extra specific directory reference was necessary... Maybe Apache couldn't understand where to apply this because of the lack of a path or multiple possible paths...? The odd part to me is a .htaccess file in the directory should have TOLD Apache where to apply it but that did not work. Important Point: I put the above in my httpd.conf... it can probably go back into the .htaccess but I'm not defining my virtual hosts in the .htaccess
(Apache 2.4 note: I don't know how this would work in Apache 2.4 where it's highly recommended that virtual hosts go into the file for virtual hosts... I'm guessing this all may have gone in there and everything would work just like here... but I actually don't know).

Anyway this worked. I hope it works for anyone else having a similar problem (NOTE: I'm working with someone else who is having difficulties getting this to work on their windows 7 development machine... I will have him try the above and see if it fixes his problem for him as well & try to remember to report back).

Upvotes: 1

Related Questions