简体   繁体   中英

.HTACCESS Apache Mod_Rewrite not working

I have tried to manage my website's requests from http://example.com/index.php/register to http://example.com/register

But it always shows no input file specified.

Now all i want to do is to remove the /index.php and rewrite the requests. here is my .HTACCESS file i have tried multiple things but no luck.

 <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

Just let me know where the issue is.

No need to write RewriteBase /

Use below htaccess.

# Turn mod_rewrite on
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L] 
# add / before index.php

Hope it will work :-)

Can you try this:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule ^(.*)$ /index.php/$1 [L] 

There may be some reasons for not working this code

First - Allow override in apache config, You should know where is your apache config, usually it is in the /etc/apache2/sites-available/default

<Directory "/path/to/document/root/">
  AllowOverride All
  Allow from All
</Directory>

Second - mod_rewrite is not enable, so you should enter this command for enabling that.

sudo a2enmod rewrite
sudo service apache2 restart

Third - If still your rewrite mode doesn't work, or you don't have an access to change the config of the server you can see your register page like this: http://quepos.fishing/index.php/register

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM