.htaccess

Allow URL access, disallow subdirectory access

I have a second website stored in the root of my main website. It’s a subdomain with its own URL I want users to access the second website via a URL eg www.mysecondwebsite.com but not via the first website eg www.myfirstwebsite.com/mysecondwebsite Can this be done via .htaccess? If so where do I put the .htaccess file: in the root of…
Read more

htaccess – Need help writing the correct rule

I’m using SimpleMVCFramework All my routes are working fine, based on the default htaccess file: Options -Indexes <IfModule mod_rewrite.c> Options -Indexes RewriteEngine On RewriteBase /mpl/servicos/smvcf/ # Force to exclude the trailing slash RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.*)/$ RewriteRule ^(.+)/$ $1 [R=307,L] # Allow any files or directories that exist to be displayed directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d…
Read more

Apache 301 Redirects where original URL contains special characters

I’m looking for some .htaccess Redirect or RewriteRule assistance. My client has a site that use to have poorly formatted URLs that are being reported by Google Web Tools as 404 errors, for example: /calendar-of-events/wanda-hollberg’s-fused-glass-jewelry-trunk-show/ Notice the bad apostrophe, ” ’ ” character? Here’s another example: /dining club.cfm Notice the space, ” “? One more example: /calendar-of-events/“a-viticultural-voyage”-wine-dinnerstar/ Notice the bad…
Read more

Htaccess redirect code conflicting with mod_speling code

My website pages/folder has lowercase and uppercase letters. My VPS not redirecting if the case are different (previous host did) so I added mod_speling.c in htaccess which is.. <IfModule mod_speling.c> CheckCaseOnly on CheckSpelling on </IfModule> also to redirect directory and its pages like.. domain.net/one/two/three/four to domain.net/one/two/three/ which is.. RedirectMatch temp /one/two/([^/]+)/([^/]+)/ http://domain.net/one/two/$1/ now this RedirectMatch code conflicting with mod_speling, If…
Read more

Redirect URL with query string on same domain but different directory using htaccess

I am trying to redirect a page to another page along with query string. Example: The URL below http://example.com/firstdir/?abc=xyz needs to redirect to the below URL with same query string on same domain. http://example.com/seconddir/?abc=xyz When there are no query string added in the URL, it should stay on the same page and will not redirect. I have tried to explain…
Read more

PHP CodeIgniter application not opening any page except default controller

My website was hosted on domain seeingtheworld.org and my htaccess was as follows: php_value upload_max_filesize 1024M php_value post_max_size 1024M php_value max_execution_time 2700 php_value max_input_time 2700 Options +FollowSymlinks RewriteEngine On RewriteBase /seeingtheworld RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php/$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] This is the link working fine. http://seeing-the-world.org/ Now I have hosted this…
Read more