mod-rewrite

Running PHP without extension without using mod_rewrite?

让人想犯罪 __ 提交于 2019-12-18 11:53:27
问题 Using Apache 2.2 and PHP 5, what's the best way to run PHP without the .php extension? For example, I have a script called app.php and I like to invoke it as: http://example.com/app Please notice that I still want to keep the .php extension to the file and I don't have mod_rewrite . Don't want use index.php either because it requires too many directories. I did find one way by adding this to my .htaccess , AddHandler server-parsed .php SetHandler application/x-httpd-php AddHandler application

.htaccess with or without slash

社会主义新天地 提交于 2019-12-18 11:51:22
问题 What do I need to do to the following rewrite rule to make it so it works whether or not their is a slash at the end of the URL? ie. http://mydomain.com/content/featured or http://mydomain.com/content/featured/ RewriteRule ^content/featured/ /content/today.html 回答1: Use the $ to mark the end of the string and the ? to mark the preceding expression to be repeated zero or one times: RewriteRule ^content/featured/?$ content/today.html But I recommend you to stick to one notation and correct

Stylesheet does not load after using RewriteRule and include

 ̄綄美尐妖づ 提交于 2019-12-18 09:46:35
问题 I have a website that has an index.php, a few simple .html pages and one .php page (contact form) as well as a .htaccess file. On my website I have buttons that point to the pages as follows: index.php?p=welcome.php (example). As you can see, the index.php file includes a page, depending on what was passed on by GET . I've written the .htaccess to show: http://www.site.com/welcome/ instead of http://www.sites.com/index.php?p=welcome . The links and rewrite both work. The only problem I have

Can't access URL in Laravel routes

自作多情 提交于 2019-12-18 09:39:55
问题 I am studying Laravel right now and I am doing it by creating a simple CRUD (CREATE-READ-UPDATE-DELETE). This is my way of learning new framework. Before I am using CodeIgniter but I found out that Laravel is much better than CodeIgniter and it has a lot of features. I am following this tutorial http://www.allshorevirtualstaffing.com/developing-crud-applications-in-laravel-4/ And I am in the displaying of CREATE view. But I can't access the routes of it. This is my folder structure wamp www

htaccess rewrite to new domain

为君一笑 提交于 2019-12-18 09:36:46
问题 I have this: Options -Indexes RewriteEngine On RewriteCond %{HTTP_HOST} ^findmyfiver\.com$ RewriteRule (.*) http://www.findmyfiver.com/$1 [L,R] Which successfully forces a user to the www. version on the site; however I want to redirect a user to a specific domain and page when they enter: findmyfiver.com/tester.php to findmyfiver.co.uk/tester.php How is this done? 回答1: Options -Indexes RewriteEngine On RewriteCond %{HTTP_HOST} ^findmyfiver\.com$ # Add a rule to rewrite tester.php to a

Mod rewrite query parameter validation and blocking also request url blocking

戏子无情 提交于 2019-12-18 09:18:07
问题 On my site, only few query query parameters are allowed but, some scanners or hackers trying to access url with unique parameters which my php application doesn't support, I can block them in php application level, by validating $_GET parameters, but my server is getting loaded, so I want to show 403 if parameters are not valid Query parameters can be in any order So far what I tried is as follows # IF there is query string RewriteCond %{QUERY_STRING} ^.+$ # Then parameters can be only query

Turn off SSL for every page except login.php and register.php

瘦欲@ 提交于 2019-12-18 08:55:32
问题 Options +FollowSymLinks RewriteEngine On # Turn SSL off for everything except login.php (register.php) RewriteCond %{HTTPS} on RewriteCond %{SCRIPT_FILENAME} !\/login\.php [NC] RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L] The code above is used to turn SSL (https://) off for every page except login.php. How can I add register.php page, so I will have https:// protocol enabled on both login.php and register.php pages? I tried duplicating this line RewriteCond %{SCRIPT_FILENAME} !\/login

How to rewrite a URL with %23 in it?

你。 提交于 2019-12-18 08:26:25
问题 I have a (wordpress) blog where after commenting the users are redirected back to the page with an anchor to their comment. Should look like this: http://example.org/foo-bar/#comment-570630 But somehow I get a lot of 404 ins my logfiles for such URLs: http://example.org/foo-bar/%23comment-570630 Is there a way to write a .htaccess rewrite rule to fix this? Bonus question: Any idea why this happens and what I can do about it? 回答1: %23 is the URL encoded representation of # . I suspect your

AWS Elasticbeanstalk single instance Force SSL Redirect loop

≯℡__Kan透↙ 提交于 2019-12-18 08:26:13
问题 I'm having issues by forcing ssl. I'm using codeigniter and deployed it in AWS single instance with elasticbeanstalk. My htaccess rules below: RewriteEngine On RewriteCond %{HTTPS} off RewriteRule !/status https://%{SERVER_NAME}%{REQUEST_URI} [L,R] RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [L] But browser gets in a redirect loop. Whatever i tried didnt solve this problem. 回答1: As I mentioned in my comment: in the

mod_rewrite loops even with L flag

为君一笑 提交于 2019-12-18 08:14:24
问题 I've got a problem with rewriting a URL to a fastcgi dispatcher. If I leave only: RewriteRule ^(.*)$ dispatch.fcgi/$1 [L,QSA] I expected L (last rule) to cause only a single rewrite. Instead, it keeps prepending dispatch.fcgi until apache reports an error. I know it can be fixed with: RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ dispatch.fcgi/$1 [L,QSA] But what is the reason for multiple rewrites? Does L do something else than I think it does? 回答1: I know it's an old question, but