eekeek Posted March 3, 2010 Share Posted March 3, 2010 I understand mod_rewrite rules can go in the .htaccess file, but where else can you put them? One of the apache2 config files? My setup is a Xubuntu 9.10 apache2 server and I'm pretty sure that 'RewriteMap' does not work in .htaccess. I know I have a lot to learn still, but ultimately I'm trying to achieve case insensitive urls. Quote Link to comment https://forums.phpfreaks.com/topic/194044-mod_rewrite-rules-file-location/ Share on other sites More sharing options...
trq Posted March 3, 2010 Share Posted March 3, 2010 You can also place them within your vhost configurations. They should be within /etc/apache2/sites-enabled on Debian derivatives. Quote Link to comment https://forums.phpfreaks.com/topic/194044-mod_rewrite-rules-file-location/#findComment-1021142 Share on other sites More sharing options...
eekeek Posted March 4, 2010 Author Share Posted March 4, 2010 thanks thorpe! Your post pointed me in the right direction. I found and used this tutorial to get virtual hosts up and working - http://www.kandar.info/index.php/linux/create-apache-namebase-virtualhost-on-ubuntu I put some rewrite rules in the virtual host file for the appropriate domain under sites-enabled and was able to do a simple redirect. However, then I tried to drop in some code that makes urls case insensitive. After saving the file and upon 'sudo /etc/init.d/apache2 reload' I received a syntax error message that 'RewriteMap not allowed here...Fail!' So, I suppose the obvious question now is if 'RewriteMap' is required for case insensitive urls, where do I put this code? Quote Link to comment https://forums.phpfreaks.com/topic/194044-mod_rewrite-rules-file-location/#findComment-1021293 Share on other sites More sharing options...
trq Posted March 5, 2010 Share Posted March 5, 2010 The manual entry for each Apache directive will tell you what context it can be placed within. The man entry for rewrite_map clearly states that this directive can be used within both server config & virtual host config files. Quote Link to comment https://forums.phpfreaks.com/topic/194044-mod_rewrite-rules-file-location/#findComment-1021730 Share on other sites More sharing options...
eekeek Posted March 6, 2010 Author Share Posted March 6, 2010 Got it! - I know I'm still very ignorant about the ins and outs of apache. Thanks again for your comments thorpe. I moved my code from inside the <Directory> tags to just inside the <VirtualHost> tags and it worked. Quote Link to comment https://forums.phpfreaks.com/topic/194044-mod_rewrite-rules-file-location/#findComment-1022494 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.