skip to Main Content

i have a problem it in the direction in URLs ..

i create me new URL in xampp

pro_mvc.com

and i want to write in .htaccess this code

<IfModule mod_rewrite.c>
  Options -Multiviews
  RewriteEngine On
  RewriteBase /mvc_pro/public
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule  ^(.+)$ index.php?url=$1 [QSA,L]
</IfModule>

and i have public inside the mvc_pro in my htdocs is

C:xampphtdocsmvc_propublic

and i create my mvc_pro.com rather localhost in

C:WindowsSystem32driversetchosts

with this code

127.0.0.1 mvc_pro.com

and in apache code is in

C:xamppapacheconfextrahttpd-vhosts.conf

have

<VirtualHost *:80>

    DocumentRoot "C:xampphtdocsmvc_pro"
    ServerName mvc_pro.com

</VirtualHost>

if i want to write any thing after mvc_pro.com/public like mvc_pro.com/public/qwjleqweuqwe he not turn me to index.php ” and i have this file in my path ” why he tell me

Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

Error 404
mvc_pro.com
Apache/2.4.34 (Win32) OpenSSL/1.1.0i PHP/7.2.10

thanks again !

2

Answers


  1. Chosen as BEST ANSWER

    in :

    <IfModule mod_rewrite.c>
      Options -Multiviews
      RewriteEngine On
      RewriteBase /mvc_pro/public
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule  ^(.+)$ index.php?url=$1 [QSA,L]
    </IfModule>
    

    just remove

    RewriteBase /mvc_pro/public
    

  2. AllowOverride directive is used to allow the use of .htaccess within the web server to allow overriding of the Apache config.

    1. Ensure that mod_rewrite is enabled in httpd.conf. For XAMPP, it should be enabled
      by default.
    2. Set AllowOverride All in httpd-vhosts.conf for the document root directory
    3. Make sure to restart Apache

    Your VirtualHost config should look like this:

    <VirtualHost *:80>
        DocumentRoot "C:xampphtdocsmvc_pro"
        ServerName mvc_pro.com
        <Directory C:xampphtdocsmvc_pro>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>
    </VirtualHost>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search