0

I'm new to configuring API web servers and I'm trying to enable URL rewriting for the server so that a user can go to my public DNS.com/getAlbum to access a method within my api.php file (assumption, I'm still learning this all). I was given the command cd /etc/apache2/mods-enabled; ln -s ../mods/rewrite.load rewrite.load, however when I run that, it says it fails to create the symbolic link "rewrite.load": File exists. I checked this file and it contains the same code located in mods-available/rewrite.load, so I think there is something incorrect in apache2.conf. I can also update this to include any needed info. How do enable URL rewriting to get my API working?

migrated from unix.stackexchange.com Apr 24 '15 at 23:25

This question came from our site for users of Linux, FreeBSD and other Un*x-like operating systems.

1

First, the easier way to enable a modules is with a2enmod So you could do a2enmod rewrite.

But that 'file exists' error you're getting probably means its already enabled. Make sure to do an apache2ctl graceful to activate the new config.

  • Thanks for the reply @derobert, running your command apache2ctl graceful returns the following.. httpd not running, trying to start (13)Permission denied: AH00072: make_sock: could not bind to address [::]:80 (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down AH00015: Unable to open logs Action 'graceful' failed. – exeleon Apr 24 '15 at 22:14
  • @exeleon need to run it as root. Or with sudo in front of it. – derobert Apr 24 '15 at 22:18
  • Thanks it worked however I cannot access methods within api.php by going to http://my public dns.com/methodname, though I can access other files normally via the browser. could it be something incorrectly set in htaccess or apache2.conf? – exeleon Apr 24 '15 at 22:25
  • @exeleon quite possibly. Your rewrite rules might be wrong, your vhost set up wrong, etc. Now that you've got the rewrite module enabled, you can ask questions about those... I'm not sure if here is the best place or if Webmasters wants rewrite questions. – derobert Apr 24 '15 at 22:37
  • Thanks for all of your help @derobert! I'll head over there- – exeleon Apr 24 '15 at 22:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.