user889030
user889030

Reputation: 4764

htaccess redirect all urls in directory to index.php

i have script in directory and on root wordpress is running which is creating problems when i try to run script in sub directory , throwing 404 error

my website structure

wordpress : /
script    : /Software/

my script have urls like

> http://www.domain.com/Software/home
> http://www.domain.com/Software/caseForm
> http://www.domain.com/Software/createuser

so i want that all urls like above to be redirected to index.php of software directory

what i tried

RewriteEngine on
RewriteBase /Software
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

but my current htaccess configuration is throwing me error No input file specified.

Upvotes: 1

Views: 3075

Answers (1)

Martin
Martin

Reputation: 22770

Some precursory notes:

  • The NC tag means No Case meaning the tags are case insensitive. Recommended.
  • The QSA tag means Query String Append meaning things like ?file=filename&horse=neddy from the original URI are appended to the rewritten URI. May be something you'd need here?

To solve Your error:

No input file specified.

Is caused by various issues and can be solved by tweaking the last line to include a ? and removing the preceeding slash from the destination directory, so it become:

RewriteRule ^(.*)$ index.php?/$1 [L]

(Source)

Full rewrite:

RewriteEngine on
RewriteBase /Software
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php?/$1 [NC,QSA,L]

Also review this answer.

Upvotes: 2

Related Questions