Posts

Showing posts with the label .htaccess

Combine multiple FilesMatch (specific files)

Combine multiple FilesMatch (specific files) How can I combine multiple FilesMatch for specific files ? All the examples I found are for combining file extensions In my case I only want to allow 3 files : /img/logo.png /sound/true.p3 /sound/false.mp3 I tested that but it's not clean : <FilesMatch logo.png> Allow from all Satisfy Any </FilesMatch> <FilesMatch true.mp3> Allow from all Satisfy Any </FilesMatch> <FilesMatch false.mp3> Allow from all Satisfy Any </FilesMatch> 1 Answer 1 You can use <filesMatch> with regex pattern to test multiple files <filesMatch> <filesMatch "(logo.png|true.p3|test.jpg)"> Allow from all Satisfy Any </filesMatch> Documentation of the FilesMatch directive is here. FilesMatch Thank you, Can I add the file tree ? Like : " imglogo.png" ? ...

codeigniter is not working after uploading in the server

codeigniter is not working after uploading in the server My site http://www.bishal.prtia.com/prT_base/ throw an 404 error while loading in the server. http://www.bishal.prtia.com/prT_base/ 404 It works perfectly in the localhost . I tried changing everything that mentioned in this forum like changing .htaccess to web.config and changing base url routing config etc but it still throws an error. localhost .htaccess Basically you need to show us your code and the other config to determine the problem – Riyenz Dec 27 '17 at 7:44 should i copy paste the whole code here?? Please specify anything u want to see – Bishal Chhetri Dec 27 '17 at 7:45 have you find the ...

Facebook comments breaking url ?fb_comment_id=xxxx

Facebook comments breaking url ?fb_comment_id=xxxx I have problem on facebook wall I have a link to comment http://loza.....pl/nowe/item/953-5-min-przed-koncem-swiata.html?fb_comment_id=fbc_10150440148781931_20104033_10150440188111931#f15a26d354fc36e - facebook added something to url and comments are not visible... When you go directly to: http://loza.....pl/nowe/item/953-5-min-przed-koncem-swiata.html everything is fine, fb comments are visible so I want to make a rewrite rule... on htaccess any help...pls Did you solve it? I'm facing the same problem now. – shem Oct 9 '12 at 13:12 possibly duplicate: stackoverflow.com/questions/8452529/… – shem Oct 9 '12 at 13:36 ...

htaccess rewrite subdirectory as root and also redirect if the subdirectory is accessed directly

htaccess rewrite subdirectory as root and also redirect if the subdirectory is accessed directly https://example.com/public https://example.com/public/faq.php https://example.com https://example.com/faq.php RewriteEngine On Options +FollowSymLinks RewriteRule ^$ public/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ public/$1 [L] This rule works very well but it doesn't redirect if someone access "https://example.com/public/" or "https://example.com/public/faq.php" I have found a workaround for this. I have added below code to redirect if the public directory will be accessed directly. RewriteCond %{THE_REQUEST} /public [NC] RewriteRule .* / [L,R] Please read Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers? - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining...

Redirect any directory if it has a specific query string

Redirect any directory if it has a specific query string I am trying to redirect all pages with a specific query string to another page. So many pages have this query string, but the URI's are different. I want to capture any URI and if it has this query string to redirect it but nothing I am doing is working. So just to be clear: http://example.com/?redirectme=1 would redirect to http://example.com/newpage while also: http://example.com/randompage/rtandomsirectory?redirectme=1 would also redirect to http://example.com/newpage I am sure there must be 2-3 lines I can put in the htaccess to do this but it is not working. This is a wordpress site if that should make a difference. Here is what I have tried: RewriteCond %{REQUEST_URI} ^/(.+) RewriteCond %{QUERY_STRING} ^redirectme=1$ RewriteRule ^/?$ http://example.com/? [R=301,L] and RewriteCond %{REQUEST_URI} ^/(.+) RewriteCond %{QUERY_STRING} ^redirectme=1$ RewriteRule (.*) http://example.com/? [R=301,L] different variations: Rewrite...

htaccess php_value auto_prepend_file gives me internal 500 error

htaccess php_value auto_prepend_file gives me internal 500 error I have a problem with php_value auto_prepend_file from htaccess . It gives me 500 Internal Server Error. The following htaccess codes is working fine on localhost but gives me 500 Internal Server Error on online server. Where is the problem and what is the solution ? Anyone can help me in this regard please ? php_value auto_prepend_file Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase /script/ RewriteCond %{REQUEST_METHOD} !POST RewriteCond %{THE_REQUEST} s/+(.+?).php[s?] [NC] RewriteRule ^ %1 [R=302,NE,L] RewriteCond %{THE_REQUEST} /index.php [NC] RewriteRule ^(.*)index.php$ $1 [L,R=302,NC,NE] RewriteCond %{REQUEST_FILENAME} -d [OR] RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^ - [L] RewriteRule ^post/([w-]+)/?$ sources/post.php?msgID=$1 [L,QSA] RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.+?)/?$ $1.php [L] RewriteRule ^(.+?)/?$ index.php?pages=$1 [L,QSA] php_value auto_prepend_file "/ho...

Spurious, but frequent double slashes in path after Apache mod_rewrite

Spurious, but frequent double slashes in path after Apache mod_rewrite A client wants to strengthen his main brand and consolidated the content of the various domains used for the respective sub-brands in subdirectories under the hood of his main domain (brand): www.example.com |_ .htaccess |_ brand1 |_ files |_ includes/header.inc |_ scripts/functions.php |_ brand2 |_ brand3 All hitherto separate domains now point at www.example.com , in .htaccess in root requests are rewritten to the resp. subdirectories (some domains are treated individually as domain/brand do not translate one to one, but the pattern is the same): www.example.com .htaccess RewriteCond %{HTTP_HOST} ^(www.)?(brand1|brand2|brand3).com$ [NC] RewriteRule ^ https://www.example.com/%2%{REQUEST_URI} [R=301,L] These directives are followed by a RewriteBase / di...