mod-rewrite

Moving Codeigniter Project to Amazon EC2, htaccess and ModRewrite Problems

╄→гoц情女王★ 提交于 2020-01-10 20:04:11
问题 I am attempting to move my Codeigniter projects from a shared hosting service to Amazon EC2 and am running into some challenges with my .htaccess settings. These settings enabled me to not have to include index.php in the url. My previous .htaccess is shown below and worked as expected with my previous hosting provider: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /simple.com/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L]

Simple problem with mod_rewrite in the Fat Free Framework

亡梦爱人 提交于 2020-01-10 03:03:18
问题 I am trying to setup and learn the Fat Free Framework for PHP. http://fatfree.sourceforge.net/ It's is fairly simple to setup and I am running it on my machine using MAMP. I was able to get the 'hello world' example running just fin: require_once 'path/to/F3.php'; F3::route('GET /','home'); function home() { echo 'Hello, world!'; } F3::run(); But when I try to add in the second part, which has two routes: require_once 'F3/F3.php'; F3::route('GET /','home'); function home() { echo 'Hello,

Url rewriting mod_rewrite

给你一囗甜甜゛ 提交于 2020-01-09 11:53:04
问题 I have the url such as: page.com/content.php?xname=p&yname=q&zid=1 I want to rewrite this url using apache mod_rewrite into something like: page.com/p/q/ note there should not be 'zid' parameter in renamed url. I know expressions are passed as GET into the original url. Is it possible to rename as above. If yes, How to achieve this? 回答1: This one works fine for me and will rewrite request for /p/q/ to /content.php?xname=p&yname=q&zid=1 . Options +FollowSymLinks -MultiViews RewriteEngine On

Url rewriting mod_rewrite

旧城冷巷雨未停 提交于 2020-01-09 11:51:48
问题 I have the url such as: page.com/content.php?xname=p&yname=q&zid=1 I want to rewrite this url using apache mod_rewrite into something like: page.com/p/q/ note there should not be 'zid' parameter in renamed url. I know expressions are passed as GET into the original url. Is it possible to rename as above. If yes, How to achieve this? 回答1: This one works fine for me and will rewrite request for /p/q/ to /content.php?xname=p&yname=q&zid=1 . Options +FollowSymLinks -MultiViews RewriteEngine On

Missing CSS file and images after URL rewrite

家住魔仙堡 提交于 2020-01-09 06:55:33
问题 I'm trying to make user friendly URL using mode rewrite. My problem is, that after giving category like 'name' to my URL, when I call the page using new URL, it can't load the CSS file or images. I have a link like: localhost/mywebsite/project?id=22 New link is something like localhost/mywebsite/project/22/myproject.project htaccess code: RewriteRule ^project/([0-9]*)/.*\.project$ /project.php?project=$1 [L] (it might not be 100% right but I don't have access to my code right now so I just

why does the regex in my rewrite condition seem to not catch?

余生长醉 提交于 2020-01-07 08:07:49
问题 I have URLs like the following: mysite.com/eng?sentence=dog and I want to rewrite them as mysite.com/eng/dog so I want to replace ?sentence= with a "/" I have tried all of the following: RewriteCond %{THE_REQUEST} ^GET\ sentence= [NC] RewriteRule ^ /%1 [NC,L,NE] RewriteCond %{THE_REQUEST} ^GET\ \?sentence= [NC] RewriteRule ^ /%1 [NC,L,NE] RewriteCond %{THE_REQUEST} ^GET\ \?sentence=([^/?&\s]+) [NC] RewriteRule ^ /%1 [NC,L,NE] RewriteCond %{THE_REQUEST} ^GET\s/+\?sentence=([^/?&\s]+) [NC]

.htaccess remove .php and force trailing slash

99封情书 提交于 2020-01-07 05:43:15
问题 I have files in my root folder. jobs.php , contact.php . I want to be able to use .htaccess to remove the .php extension and force a trailing slash / . So that, www.domain.com/jobs/ and www.domain.com/contact/ goes to their respective pages. Also, I want jobs.domain.com to point to www.domain.com/jobs/ <IfModule mod_rewrite.c> Options +SymLinksIfOwnerMatch RewriteEngine On RewriteBase / RewriteRule ^(rosquillos)/$ $1 [L,R=301,NC] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST

.htaccess remove .php and force trailing slash

天大地大妈咪最大 提交于 2020-01-07 05:42:14
问题 I have files in my root folder. jobs.php , contact.php . I want to be able to use .htaccess to remove the .php extension and force a trailing slash / . So that, www.domain.com/jobs/ and www.domain.com/contact/ goes to their respective pages. Also, I want jobs.domain.com to point to www.domain.com/jobs/ <IfModule mod_rewrite.c> Options +SymLinksIfOwnerMatch RewriteEngine On RewriteBase / RewriteRule ^(rosquillos)/$ $1 [L,R=301,NC] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST

Get a parameter from a rewritten URL with javascript

假如想象 提交于 2020-01-07 05:37:05
问题 I am trying to get a url parameter using javascript so i can pass the paramter to google maps The problem is i'm using mod rewrite on the url www.mysite.com/1/my-event instead of www.mysite.com/mypage.php?id=1&name=my-event I've tried doing an alert but it comes up blank Here is the javascript function that will work if i don't rewrite the url function gup( name ){ name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^&#]*)"; var regex = new RegExp( regexS

IfModule doesn't appear to be working?

余生长醉 提交于 2020-01-07 05:36:06
问题 If I use this: <IfModule mod_rewrite.c> RewriteEngine On RedirectMatch 301 ^/training/(.*) /faculty/training.html </IfModule> the redirects don't occur. Same with: <IfModule mod_rewrite> ... </IfModule> However, this works as expected: RewriteEngine On RedirectMatch 301 ^/training/(.*) /faculty/training.html In other words, the redirect works fine outside of the <IfModule> block. Is there a reason why <IfModule> wouldn't detect mod_rewrite.c? 回答1: The RedirectMatch directive is part of mod