.htaccess

Directing Non-Slash URL to Slash

北战南征 提交于 2021-02-10 11:03:29
问题 When I enter the website.com/seo link, I want to make a 301 redirect to the website.com/seo/ link. However, I don't want it to be broken in the codes I wrote in the current htaccess. my htacces codes: RewriteEngine On RewriteBase / RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC] RewriteRule ^ %1/ [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*?)/?$ $1.php [NC,L] 回答1: Use only one of these, do not use together! Try: RewriteEngine

Protecting certain files and folders from view within a public folder

≡放荡痞女 提交于 2021-02-10 10:18:08
问题 Today I've been struggling with this for a while. What I am trying to accomplish is that I need to block all users from acessing a certain php files and images and more things (they are in a separate folder). I am using WAMP-server. I do not want the users to be able to go to just that site, like "www/images/crazy-cat-picture.jpg" (or more like "www/phpScripts/sign-up-user.php") but I still want the users ta be able to see the pictures on my website and call the php scripts. I tried 3

Run PHP pages without an extension

蹲街弑〆低调 提交于 2021-02-10 07:39:28
问题 I want to run my PHP web pages on an apache web server without the .php extension. So I added the following code: RewriteEngine on RewriteBase / Rewritecond %{REQUEST_URI} !(^/?.*\..*$) [NC] RewriteRule (.*)$ $1.php [NC] in the .htaccess file. This solves my problem but another problem arises. I cannot view the content of any directory (i.e. the file contained in the directory). Please provide me an alternate RewriteRule without this problem. 回答1: You need to make sure that the request URI

Wordpress/htaccess - allow access to subdirectory

北慕城南 提交于 2021-02-10 07:34:33
问题 I have a subdirectory ( app ) I want to access that is in the root folder of my wordpress site. I have looked here: https://wordpress.stackexchange.com/questions/20152/cannot-access-non-wordpress-subdirectories-as-wordpress-overrides-them-with-a-40 I have tried the solutions and nothing worked. I also tried adding a separate .htaccess file to the app subdirectory that looks like this: DirectoryIndex index.php index.html index.htm Options +Indexes But it didn't seem to help: The main .htaccess

.Htaccess redirect to 404 page when certain files doesn't exist

夙愿已清 提交于 2021-02-10 07:15:48
问题 I've been working with my own MVC system for a while now and it works great! I use this in my .htaccess RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.+)$ index.php?page=$1 [QSA,L] Now, when a page (controller) doesn't exist, I redirect to /error (in the index.php file) . But there are some scenarios when a picture will be deleted in a folder, and still be printed in the html page. This will

.Htaccess redirect to 404 page when certain files doesn't exist

混江龙づ霸主 提交于 2021-02-10 07:15:41
问题 I've been working with my own MVC system for a while now and it works great! I use this in my .htaccess RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.+)$ index.php?page=$1 [QSA,L] Now, when a page (controller) doesn't exist, I redirect to /error (in the index.php file) . But there are some scenarios when a picture will be deleted in a folder, and still be printed in the html page. This will

.Htaccess redirect to 404 page when certain files doesn't exist

点点圈 提交于 2021-02-10 07:14:56
问题 I've been working with my own MVC system for a while now and it works great! I use this in my .htaccess RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.+)$ index.php?page=$1 [QSA,L] Now, when a page (controller) doesn't exist, I redirect to /error (in the index.php file) . But there are some scenarios when a picture will be deleted in a folder, and still be printed in the html page. This will

.Htaccess redirect to 404 page when certain files doesn't exist

懵懂的女人 提交于 2021-02-10 07:14:27
问题 I've been working with my own MVC system for a while now and it works great! I use this in my .htaccess RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.+)$ index.php?page=$1 [QSA,L] Now, when a page (controller) doesn't exist, I redirect to /error (in the index.php file) . But there are some scenarios when a picture will be deleted in a folder, and still be printed in the html page. This will

.Htaccess redirect to 404 page when certain files doesn't exist

大憨熊 提交于 2021-02-10 07:14:24
问题 I've been working with my own MVC system for a while now and it works great! I use this in my .htaccess RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.+)$ index.php?page=$1 [QSA,L] Now, when a page (controller) doesn't exist, I redirect to /error (in the index.php file) . But there are some scenarios when a picture will be deleted in a folder, and still be printed in the html page. This will

base_url() and 403 error in CodeIgniter

試著忘記壹切 提交于 2021-02-09 08:17:05
问题 In HTML view, css link code looks like this: <link href='www.jedendzien.pl/assets/css/style.css' rel='stylesheet'> but my browser is showing adress with double domain adress www.jedendzien.pl/www.jedendzien.pl/assets/css/style.css so i'm getting 403 error. I create link by <link href='<?php echo base_url(); ?>assets/css/style.css' rel='stylesheet'> and in config.php i'm setting: $config['base_url'] = 'www.jedendzien.pl/'; In my XAMPP serwer everthing works fine but problem is appearig only on