No input file specified -LAMP(Apache) - php

Anyone can help with my htaccess file, its working with the root domain directory folder only, if i put the index file into the root domain directory and access page like this https://example.com/edr/login , it works nicely . However when i create folder inside it and try to access site like this , https://example.com/createdfolder/edr/login, it says 'No input file exist. Below is my htaaccess file codes. My $_SERVER['QUERY_STRING'] is set to 'login'
Options All -Indexes
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f [NC]
RewriteRule ^(.*)$ $1.php [L]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L]

If to copy WordPress' .htaccess it would look like this:
RewriteEngine On
RewriteBase /createfolder/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /createfolder/index.php [L]
Of course you can replace createfolder/ with your/path/

Related

htaccess url folder redirect

I am trying to change my url to try to stop it from showing the language folder in the url for example:
change from
www.site.com/en
change to
www.site.com
so I am looking to remove the
en
from the url but still accessing that directory. This is what I have so far but it does not seem to do the trick:
RewriteEngine on
RewriteBase /mysite/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .+ en=$0 [L,QSA]
Thank you.
This should do it:
RewriteEngine on
RewriteBase /mysite/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ en/$1 [L,QSA]

unable to rewrite url - PHP

I have a link -
http://www.website.com/vendor.php/brand-name
Here brand name is dynamic and this works fine
But now I want to convert this link into
http://www.website.com/vendor/brand-name
when i try to access this - i get No input file specified.
I want to remove .php for only one file in my project - vendor.php
and want to run it as
http://www.website.com/vendor/brand-name
DirectoryIndex index.php
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^vendor/brand-name$ /vendor.php/$1 [L]
RewriteRule ^(.*)$ /vendor.php?tag=$1 [L]
Options -Indexes
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to vendor.php
RewriteRule . vebdor.php
This should work
DirectoryIndex index.php
RewriteEngine on
RewriteBase /
#Rewrite "/vendor/foo" to "vendor.php/foo"
RewriteRule ^vendor/([^/]+)/?$ /vendor.php/$1 [NC,L]
#Rewrite to vendor.php?tag=
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /vendor.php?tag=$1 [L]

How to load default index file with .htaccess for variable directory structure in url

Lets say my site structure is like this:
www.mywebsite.com/directory/$variabledirectoryname/$variableproductlink
As you can see in the middle i have 2 variables in the url, but the last is the poduct link. My index.php file stays in www.mywebsite.com/directory/$variabledirectoryname folder. How to load it?
I have this code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/?$ index.php [L]
But it doesnt work.. Thanks !
You can use this rule in /directory/.htaccess:
RewriteEngine On
RewriteBase /directory/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/[^/]+/?$ $1/index.php [L]
Update:
You can use this rule in root .htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(directory/[^/]+)/[^/]+/?$ $1/index.php [L]

apache htaccess codeigniter query string to path

i'm trying to make a codeigniter based website be able to convert index.php?option=test&controller=con1 to /test/con1 using .htaccess i tried multiple examples i found and none seem to work, it goes straight to the home page. any ideas?
i've tried things like
RewriteCond %{QUERY_STRING} ^(\w+)=(\w+)$
RewriteRule ^\/(.+?)\/(.+?)\/? /index.php/$1/$2 [L]
but doesn't throw any errors or anything.
my current htacces is
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|img|js|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
try put this .htaccess in same directory with your index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Change URL name with mod rewrite on htaccess

I am having a tough time to understand how mod_rewrite works.
I have a url like this:
www.example.com/store/index.php?categ=headbands
And I want to make it look like this:
www.example.com/store/headbands
I am trying this, but not working:
RewriteEngine on
RewriteBase /store/
RewriteRule ^index/([^/\.]+)/?$ $1 [L]
And I confirmed the mod_rewrite is activated with a random example I found.
Any suggestions?
Thanks!
Try This one
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^/store/(.*)$ /store/index.php?categ=$1 [NC,L]
OR
Put the .htaccess file inside the "store" directory with following code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?categ=$1 [NC,L]

Categories