1

I want to write apache rewrite rule for fallowing use case.

My use case is if url does not exists modify url.

e.x

http://localhost/sign does not exists redirect to http://localhost/index.php/sign

if http://localhost/images/dummy.jpg exists do nothing.

i.e if url exists do nothing else modify url and add index.php after domain name and fallowed by requested uri.

can any one help me achieving this.

Ramesh Paul
  • 840
  • 4
  • 15
  • 31
  • Your question sounds like the typical `.htaccess mod_rewrite` question covered in basically any how-to… – nietonfir Dec 30 '13 at 15:35
  • possible duplicate of [Remove 'index.php' from URL with .htaccess](http://stackoverflow.com/questions/9608366/remove-index-php-from-url-with-htaccess) – nietonfir Dec 30 '13 at 15:37

2 Answers2

2

You can use this rule in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php/$1 [L,R]
anubhava
  • 761,203
  • 64
  • 569
  • 643
0
ErrorDocument 404 /sign

ErrorDocument Directive

avarx
  • 509
  • 5
  • 21