0

I have a problem with apache giving me a "not found" error.

scenario:

I have a url of the form --> 10.17.10.19/webapps/api/index.php?url=auth

I want to rewrite the url in the form --> 10.17.10.19/webapps/api/auth

im Using Ubuntu 20.04 apache2

vhost:

      <VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/
<Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require all granted
            Order allow,deny
            allow from all
</Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

htaccess:

RewriteEngine On
Options All -Indexes
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

apache.conf

<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

<Directory /var/www/>
        Options Indexes
# FollowSymLinks
#       AllowOverride None
        Require all granted
</Directory>

#<Directory /srv/>
#       Options Indexes FollowSymLinks
#       AllowOverride None
#       Require all granted
#</Directory>

Please help me to correct the condition to recognize the parameter

14
  • i already enable aen2mod rewrite but still not works
    – Wiki wanda
    Commented Oct 21, 2022 at 9:27
  • Where is that distributed configuration file (".htaccess") located?
    – arkascha
    Commented Oct 21, 2022 at 10:03
  • /var/www/html/webapps/api/.htaccess
    – Wiki wanda
    Commented Oct 21, 2022 at 10:48
  • Why the discrepancy between DocumentRoot /var/www/html/ and <Directory /var/www/>?
    – arkascha
    Commented Oct 21, 2022 at 14:30
  • document root for landing page and directory is when we set rule right? two different things
    – Wiki wanda
    Commented Oct 21, 2022 at 21:59

1 Answer 1

0

i found the answer i need to enable header so the htaccess can work

ae2enmod header

https://httpd.apache.org/docs/2.4/mod/

2
  • Can you edit to elaborate on what exactly you did to solve the problem? This can help future people who run into the same problem and see this post.
    – starball
    Commented Oct 22, 2022 at 20:42
  • sorry guys i edited the answer
    – Wiki wanda
    Commented Oct 24, 2022 at 1:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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