1

I know this question have more answer on this page. But It is not work fine for me. I don't know why. I followed step by step as instruction. Could you please help me check. Thanks for your support The URL looks liks is : examplemysite.com

The link work well if I add index.php for it.

  1. Change config.php -> $config['index_page'] = '';
  2. $config['uri_protocol'] = 'REQUEST_URI';
  3. htaccess is located same level with index.phpenter image description here

The content of htaccess

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
6
  • is mod_rewrite enabled in your PHP? Commented Aug 29, 2018 at 16:58
  • are you running windows or linux as a web server for your app? Commented Aug 29, 2018 at 17:03
  • Hi @Phiter: Please suggest me how to check. Commented Aug 29, 2018 at 17:35
  • @unixmiah: I am running on windows Commented Aug 29, 2018 at 17:35
  • @KinQuang if you're running Apache, open your httpd.conf file and uncomment #LoadModule rewrite_modules/mod_rewrite.so then you need to add AllOverride All in your httpd.conf file. After you've done that restart Apache. Commented Aug 29, 2018 at 17:37

1 Answer 1

0

In to enable mod_rewrite for Windows and Linux, do the following:

Windows:

  • Find and open the file .http.conf. This will be located in your Apache install folder.

  • Make a backup of http.conf which you can restore from, if anything were to go wrong

  • Find the line #LoadModule rewrite_module modules/mod_rewrite.so and remove the hash ‘#’enable-mod-rewrite-1

  • Locate the block within the directory tags as indicated below and change to: Options All AllowOverride All

  • Finally, restart apache server and your browser. The .htaccess rewriting should now be working.

Linux (Ubuntu as an example):

  • Activate the mod_rewrite module with

    sudo a2enmod rewrite

and restart the apache

sudo service apache2 restart

To use mod_rewrite from within .htaccess files edit the virtualhost

sudo nano /etc/apache2/sites-available/000-default.conf

Below “DocumentRoot /var/www/html” add the following lines:

<Directory “/var/www/html”>
AllowOverride All
</Directory>

Restart the server again:

sudo service apache2 restart
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.