adding exception to the htaccess file to bypass a single URL - .htaccess

I'm a newbie with htaccess file so please bear me with my ignorance.
I'm working on a code-igniter project whereby I require to add exception for a particular URL say : www.domain.com/leaveit/file
Basically I have placed a folder at the root which I need to bypass from the rule written in htaccess file where by index.php is added for every request made.
Any suggestion / link would be highly appreciable as I have searched a lot for the solution but didn't end up with anything concrete to help me out of this issue.
Here's my htaccess code.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteRule ^(.*)$ https://www.domain.com/$1 [L,R=301]
php_flag output_buffering On
Thank in advance for your time and patience.

Simply try this
RewriteEngine on
RewriteCond $1 !^(index\.php|robots\.txt|leaveit)
RewriteRule ^(.*)$ /index.php/$1 [L]
Let us know if your problem solves or not.

Related

Some server giving "No input file specified"

I need help about my htaccess. I am using the following htaccess rules it is working perfectly some servers. But some servers giving No input file specified I have searched some solution on stack overflow.
RewriteRule ^(.*)$ index\.php/$1 [L,QSA]
For example this RewriteRule will fix RewriteRule ^(.*)$ index.php?$1 [L] the No input file specified but some pages are not opening like https://www[dot]webadress[dot]com/settings?tab=page
What do I need to do to fix No input file specified I need QSA in my RewriteRule.
Anyone can help me please.
For non-existing pages uris/requests, you could try following rules. Along with rules please make sure your index.php is residing in same folder where index.php is present. Please clear your browser cache before testing your URLs.
RewriteEngine ON
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/?$ index.php [QSA,L]

Point to a file in subfolder with .htaccess

I've wanted to move my index.php file from the root to /system/ folder, this is for no reason but giving myself opporunity to learn more about .htaccess, which I am finding very confusing.
How can I achieve this? Currently my code looks as follows
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?query=$1
This allows for example mydomain.com/some-url/ to become /index.php?query=some-url for example, this far I'm with it all. But moving the file into System folder and addind /system/ before /index.php does nothing. How does one do this? Thanks!
This could be done with a simple rewriterule. Please make sure you clear your browser cache before testing your URLs.
RewriteEngine ON
RewriteCond %{REQUEST_URI} ^/?$
RewriteRule ^(.*)$ system/index.php [L]

.htaccess works but wont let me access blog index.php in sub folder

been playing about with mod rewrite on the .htacces file.. ive managed to take of the the .html at the end my files for the url which looks a lot better, problem im getting now is that i have a blog folder which contains all my blog files including the index.php file.. problem is it wont load this page up now.. the code im using for the re-write is..
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]
the error code im getting it this
You don't have permission to access /MyFiles/katie2/blog/.html on this server.
when it should load
/myfiles/katie2/blog/index.php
any help guys would be great..
Try this rule:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
Good luck!

.htaccess multiple rewrite rules for codeigniter

I want to ask how can we add an additional rewrite rule(s) in .htaccess file including the index.php removal rule in codeigniter.
Here is my .htaccess file
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^profile/([0-9]+)$ /index.php/front/profileDetail/$1
RewriteRule ^(.*)$ /index.php/$1
The problem is that, only one of the rule works at a time. If I save the file as shown above it returns internal server error!
What I want is completely remove index.php file plus rewrite the url from xyz.com/front/profileDetail/50 into xyz.com/profile/50
Please help what's wrong, I am completely newbie in this regard.
Thanks! in advance.
To elaborate on my comment above, in config/routes, you would put:
$route['profile/(:num)'] = 'front/profileDetail/$1';

Expression Engine hide index.php not working correctly

I am working on a site that was working before someone else made some changes to the site. Now, I have to include index.php to the URL before the contact form will work.
Here is the htaccess file code I am using:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
What am I missing here?
Thanks.
The ? after index.php indicates to me that you're running PHP as CGI ... perhaps that was changed?
Also see: https://stackoverflow.com/a/11143216/174299

Resources