mod-rewrite

mod rewrite rule for parameters

ⅰ亾dé卋堺 提交于 2019-12-13 05:42:31
问题 I have below url(s) www.localhost.com/profile.php?username=first.last i would like to permanently redirect above url to using .htaaccess file. (apache server) www.localhost.com/first.last please also consider there are few other urls there but i dont want to touch them..like www.localhost.com/message.php?id=12 www.localhost.com/editprofile.php?editname=first.last www.localhost.com/uploadphoto.php?username=first.last can anyone please help me. thank you in advance. 回答1: You could try to handle

How secure is mod_rewrite on .htaccess

南楼画角 提交于 2019-12-13 05:42:08
问题 From practical experience how secure is mod_rewrite on .htaccess? 回答1: There are so called "The 11 Phases of a Request" illustrated here. Mod_rewrite hooks it self into URL translation level. You have full control over the rules. Which means you have to take care, that there is no injection. Injections can only be done, if you route your rule dynamically to folders depended on your request. This rules are IMHO easy to detect. The main purpose of mod_rewrite is to rewrite (hooked into the URI

Apache rewrite rule different if capture is empty

前提是你 提交于 2019-12-13 05:40:38
问题 what I have so far is: <VirtualHost 111.111.111.111:80> ServerName ex.me ServerAlias www.ex.me Options +FollowSymLinks RewriteEngine on RewriteRule ^/(.*)$ http://exemple.com/foo/$1 [R=301,L] </VirtualHost> what I need is if (.*) is empty, it rewrites to http://exemple.com and if it has something, it redirects to http://exemple.com/foo/$1 -- I don't know how to do the if empty rule. right now. Right now it redirects to http://exemple.com/foo/ no matter if there is something captured or not.

htaccess redirect for dynamic urls not working

孤人 提交于 2019-12-13 05:29:13
问题 I basically want: http://example.com/index.php?page=abc to redirect to http://www.exmaple.com/abc I have: RewriteCond %{QUERY_STRING} ^page=(.*)$ RewriteRule ^index.php$ %1? [R=301] RewriteRule ^%1$ index.php?page=%1 [L] 回答1: Some syntax issues in your 2nd rule and logic ones in your 1st rule. Following should work: RewriteEngine On # for external redirection from `/index.php?page=abc` to `/abc` RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+index\.php\?page=([^\s&]+) [NC] RewriteRule ^ /%1? [R=301

override apache rewrite rules with htaccess

跟風遠走 提交于 2019-12-13 05:17:23
问题 working on a server that hosts multiple domains. Somewhere in apache config is a rewrite rule that is set for ALL domains. What happens is if a user goes to example.com/foo they are supposed to get redirected to example.com/foo_bar However, in one domain, I want to override this behavior so that the url stays at example.com/foo and does not redirect. I've been searching and trying various rules and conditions to no avail. I don't have access to the apache config, but I am using .htaccess for

How to rewrites URLs in ASP.NET

浪子不回头ぞ 提交于 2019-12-13 05:17:11
问题 I have been using Helicon to rewrite my URLs and they are in a file htaccess (no dot). The rewrite goes something like: RewriteRule /e-commerce /e-commerce.asp [I,U] I have read a few answers, starting with How to Determine the Installed ASP.NET Version of Host from a Web Page. I ran the page, and it displayed 2.0.50727.3643 A little history so maybe one can be gentle. I was a Microsoft Frontpage MVP, but disliked their Frontpage Server Extensions (FPSE). Some hosting companies are still

.htaccess and changing php queries to a clean URL

有些话、适合烂在心里 提交于 2019-12-13 05:17:04
问题 I am trying to change the URL structure for my clients website, i have never worked with a htaccess file before so forgive me if its a stupid question. i have spent time looking on stack overflow, google and youtube but for the life of me i just cant get my head around this. The URL Current structure: jobtitle being the variable and Administration-Jobs being the value http://localhost/website/job_title.php?jobtitle=Administration-Jobs the URL structure the client has requested http:/

Apache RewriteRule .* index.php [NC,L] Not working

你离开我真会死。 提交于 2019-12-13 05:07:09
问题 I am trying to redirect everything to a single page from my /website/folder/ directory. I added a simple .htaccess with this simple code (I know this would require more code in .htaccess but it's just a test). RewriteEngine on RewriteRule .* index.php [NC,L] When I try : http://127.0.0.1:8888/website/folder/fileDoesntExistMustGoIndex I have an "Object not found 404" error and the access.log display: 127.0.0.1 - - [13/Mar/2010:13:48:31 -0500] "GET /website/folder/fileDoesntExistMustGoIndexHTTP

Why is this .htaccess file mod_rewrite not working?

会有一股神秘感。 提交于 2019-12-13 05:06:09
问题 I'm using MAMP and CodeIgniter. The root of my website is: /Users/Roy/Websites/CodeIgniter-3.0.2 In the Websites folder I also have some other project but I don't think that matters. Here is the apache httpd.conf file: http://pastebin.com/Am0ew0C0 In my .htaccess file I'm using the following: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] <IfModule authz_core_module> Require all denied </IfModule> <IfModule !authz

ajax page navigation not working after htaccess rewrite

浪子不回头ぞ 提交于 2019-12-13 04:45:51
问题 i use .htaccess to rewrite my url from /list.php?pat=free&mainCol=maincate&subCol=shoes to /maincate/shoes after rewrite, the ajax next page button is not working anymore. it should load list_pull.php from same folder as list.php $.post("list_pull.php",{ pageCurrent:pageClick, pullSubCol:$("#pullSubCol").val()}); and the htaccess is like this RewriteRule ^([^/.]+)/([^/.]+)$ /list.php?pat=free&mainCol=$1&subCol=$2 [L] i tried use full path http://www.mydomain.com/list_pull.php - not working i