mod-rewrite

htaccess multiple parameters rewrite rule

对着背影说爱祢 提交于 2019-12-29 07:10:06
问题 I know this problem is over asked, but couldnt find anything fitting with my problem. I'm currently creating a website, and my url are like : www.foo.com/ or www.foo.com/index.php. They can take 1, 2 ,or three different parameters like www.foo.com/index.php?page=Home&lang=en&article=1 What i'd like is an url like www.foo.com/Home/ or www.foo.com/en/Home or www.foo.com/Article/1 or www.foo.com/en/Article/1 The page parameter is required, other two are not.. I cant have anything working for me.

How to rewrite SEO friendly url's like stackoverflow

こ雲淡風輕ζ 提交于 2019-12-29 05:34:29
问题 If you go to a url like the following: http://stackoverflow.com/questions/9155602/ the address bar will be updated to http://stackoverflow.com/questions/9155602/redirect-existing-file-to-different-url-using-mod-rewrite . This is not done with JavaScript and not with a hard-refresh, my best guess is that it's done with mod_rewrite; however, how would it know the title of the article without server side processing with php? I just updated my site to use SEO friendly url's, it used to be /shows

Break HTTP file uploading from server side by PHP or Apache

不想你离开。 提交于 2019-12-29 05:24:40
问题 When uploading big file (>100M) to server, PHP always accept entire data POST from browser first. We cannot inject into the process of uploading. For example, check the value of " token " before entire data send to server is IMPOSSIBLE in my PHP code: <form enctype="multipart/form-data" action="upload.php?token=XXXXXX" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="3000000" /> Send this file: <input name="userfile" type="file" /> <input type="submit" value="Send File" /> <

Only allow certain IP addresses to access site with mod_rewrite?

此生再无相见时 提交于 2019-12-29 04:51:19
问题 We have a directory on our site which we only want to be accessible by a couple of IP addresses. So we have this .htaccess file to try and get it working: RewriteEngine on RewriteCond %(REMOTE_ADDR) !^123\.123\.123\.123 RewriteCond %(REMOTE_ADDR) !^124\.124\.124\.124 RewriteCond %{REMOTE_ADDR} !^125\.125\.125\.125 RewriteCond %{REMOTE_ADDR} !^126\.126\.126\.126 RewriteCond %{REMOTE_ADDR} !^127\.127\.127\.127 RewriteCond %{REMOTE_ADDR} !^128\.128\.128\.128 RewriteCond %{HTTP_REFERER} !^http:/

RewriteCond to skip rule if file or directory exists

坚强是说给别人听的谎言 提交于 2019-12-29 04:44:18
问题 I am trying to adjust my htacess file to skip the rewrite rule if the file or directory exists, but when the file exists, it changes the URL to something different. I don't know why this is happening. Here is my htaccess file: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f [OR] RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^project/([^/\.]+)/?$ index.php?view=project&project=$1 [L] RewriteRule ^for/content/ag index.php?view=opening&section=ag [L] RewriteRule ^for/content/bus index.php

mod_rewrite with an unknown number of variables

我们两清 提交于 2019-12-29 02:08:05
问题 I'm trying to use mod_rewrite to handle an unknown number of variables. An example URL would be: example.com/var1-var2-var3/title I have this so far: RewriteRule ^([^/.]+)-([^/]*)(.*)$ $3?version[]=$1&version[]=$2 [QSA,N] RewriteRule ^([^/.]+)/?$ ?title=$1 [QSA,N] RewriteRule ^/?$ /index.php [QSA,L] This returns: Array ( [title] => title [version] => Array ( [0] => var1-var2 [1] => var3 ) ) I need it to return: Array ( [title] => title [version] => Array ( [0] => var1 [1] => var2 [2] => var3

.htaccess mod-rewrite regex apache confusion results in 10k 404's per day

有些话、适合烂在心里 提交于 2019-12-29 01:50:06
问题 I have reviewed the many questions posted here related to .htaccess , apache , mod-rewrite and regex , but I'm just not getting it. I tried a few different things but either I am over complicating things or making beginner mistakes. Regardless, I've been at it a few days now and have completely scrambled things somewhere as the 10000 404's per day are showing. My site I have a WordPress site which contains over 23,000 posts broken down into just over 1200 categories. The site features

htaccess rewrite without redirect

此生再无相见时 提交于 2019-12-28 18:22:11
问题 All i want to do is to rewrite url from www.exaple.hu to www.exaple.cz/hu. So under address www.exaple.cz/hu is displayed content from adress www.exaple.hu. So when user type www.exaple.cz/hu, user is not redirected to www.exaple.hu but content from www.exaple.hu is displayed under domain www.exaple.cz/hu (so in adress bar is www.exaple.cz/hu). 回答1: You will need to enable mod_proxy in your Apache config for that. Once mod_proxy is enabled, enable mod_rewrite and .htaccess through httpd.conf

Codeigniter 3 Remove index.php Problems

一个人想着一个人 提交于 2019-12-28 18:14:31
问题 I have a little project that i developed for a client in codeigniter 2.1.4 and now, he insists to migrate to codeigniter 3 DEV version. I know that's not a good ideea but... My problem is that i can't remove the index.php from the url. This is my .htaccess file : Options +FollowSymLinks RewriteEngine on # Send request via index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L] I have removed the index.php from the config.php file

How do I convert a PHP query string into a slash-based URL?

折月煮酒 提交于 2019-12-28 16:04:06
问题 I am a pretty skilled programmer, but when it comes to RegEx and rewriting, I am a total n00b. I want to convert a URL from http://www.example.com/lookup.php?id=1 to http://www.example.com/lookup/1/item/ where "item" refers to the name of an item in a database that is being looked-up. I'm using LAMP (Linux, Apache, MySQL, PHP) and I cannot, for the life of me, figure out how to convert the URLs so they are SEO friendly. 回答1: Simple .htaccess example: <IfModule mod_rewrite.c> RewriteEngine On