mod-rewrite

WAMP, Laravel 5: Routes not working - NotFoundHttpException

空扰寡人 提交于 2019-12-12 15:25:28
问题 I'm using Laravel 5 with WAMP on my local machine, no virtualization. After creating a fresh project using Composer called "LaravelProject", I can't seem to get my routes working at all. What I've already done: Edited httpd.conf to uncomment the line LoadModule rewrite_module modules/mod_rewrite.so Edited the /public/.htaccess file to be Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] Refreshed WAMP

htaccess rewrite pass two variables or one depending if both are available?

微笑、不失礼 提交于 2019-12-12 15:25:00
问题 I want to pass first directory as a variable and subdirectory as another variable. It works when for urls with both directories (/something/something2) but I get an error 404 when I try with only one (/something). RewriteRule ([^/]+)/([^/]+) /posts/?category2=$1&category2=$2 [L,QSA] How can I pass only category1 when category2 isn't available? 回答1: Few solutions: Multiple rules (easier to understand but a bit slower): RewriteRule ^([^/]+) /posts/?category2=$1 [L,QSA] RewriteRule ^([^/]+)/([^/

.htaccess url rewrite behavior being overwritten if filename minus ext. same as url

▼魔方 西西 提交于 2019-12-12 14:46:39
问题 I'm trying to tidy up the URLs and remove the .php extensions from them and such. I'm in the base folder for the website, so there are no parent .htaccess files that could be taking priority or anything. Here's my htaccess code. RewriteEngine On RewriteRule ^give/?$ give.php [NC,L] This part gives no real problems, because whatever behavior is overwriting it behaves the same way. But when I add in this other line so it will account for url variables, RewriteRule ^give/([0-9]+)/?$ give.php

.htaccess mod_rewrite not working in subdirectory

风流意气都作罢 提交于 2019-12-12 14:10:56
问题 I am trying to use htaccess to rewrite all requests to main.php in a subfolder on my domain. The code in my .htaccess is the following: RewriteEngine on RewriteBase /public RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . main.php [L] I am sure the module is enabled, I have checked using the apache2ctl -M command root@vps847:/etc/apache2/sites-available# apache2ctl -M Loaded Modules: core_module (static) log_config_module (static) logio_module (static) mpm

htaccess prevent access to .php and allow only with RewriteRule

浪尽此生 提交于 2019-12-12 13:56:41
问题 I have a file .htaccess with these RewriteRules: RewriteEngine On RewriteRule ^login$ login.php [L] RewriteRule ^index$ index.php [L] RewriteRule ^page/([^/]+)/?$ page.php?id=$1 [L,QSA] It's possible to prevent direct access to all these files, but allow access only with RewriteRule For example if someone call: "domain.com/ login " should see the page. But if someone call "domain.com/ login.php " should not (in this case should see a 403 or 404 error) 回答1: You can have an additional rule for

hashtag in apache .htaccess

痴心易碎 提交于 2019-12-12 13:40:32
问题 By using the following .htaccess RewriteEngine On RewriteRule ^([0-9]+)/([0-9]+)$ /api/web/index.html#$1/$2 [R=301,NC,L] When user types the following URL at their browser. http://localhost:8080/1/2 I'm expecting, Apache will perform internal redirection, and change the displayed URL at browser too (through R=301). http://localhost:8080/api/web/index.html#1/2 Changing the displayed URL at browser is important. This is to ensure index.html 's JavaScript can parse the url correctly. However,

Drupal URL Rewriting conflict

♀尐吖头ヾ 提交于 2019-12-12 13:40:27
问题 I have Drupal 7 installed in the root directory of my site. The .htaccess file hasn't been modified since installation. However, I also have CodeIgniter set up in a subdirectory. I created a .htaccess file in the CI directory with the suggested instructions to remove index.php from the url. eg. mysite.com/subsite/index.php/blog --> mysite.com/subsite/blog RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ /index.php/$1 [L] Unfortunately doesn't work. I assume Drupal's

How to redirect url to parent directory with url rewriting

纵然是瞬间 提交于 2019-12-12 13:22:10
问题 I need to make redirections from a sub-directory to the parent directory. In other words I have to redirect anything matching http://exemple.com/portfolio/product1 to : http://exemple.com/product1 Is there any way to do that with URL REWRITE ? Thanks 回答1: Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteRule ^portfolio/(.*)$

proxy a url using mod_rewrite

限于喜欢 提交于 2019-12-12 12:23:54
问题 I have a domain for example http://example.com and another domain http://reallylargerdomain name.com I want if sombody access http://example.com/projects then server should proxy data from other url. For this i created following .htaccess file Rewrite on RewriteRule ^projects/$ http://reallylargedomainname.com [P] this is not working but when i change it to following it works Rewrite on RewriteRule ^projects/$ http://reallylargedomainname.com [R=301,L] any idea what's going wrong? 回答1: You

.htaccess - 301 redirect all files without extension to have .html extension

不羁岁月 提交于 2019-12-12 11:28:59
问题 I need to 301 redirect requests to files with no extension to same with appended .html extension: http://www.mydomain.com/this to http://www.mydomain.com/this.html The following would not get redirected: http://www.mydomain.com/that/ (it's a directory) http://www.mydomain.com/other.php Any help appreciated on the above, thanks. 回答1: Try the following. I would place it as the last rule in your set (i.e. the bottom) to not conflict with any other rules. RewriteCond %{REQUEST_FILENAME} !-d