Mod-rewrite shenanigans

I have this rewrite rule RewriteEngine On RewriteBase /location/ RewriteRule ^(.+)/?$ index.php?franchise=$1 Which is suppose to change this URL Into this one But instead I am getting this Also, adding a railing slash breaks it. I get index.php page showing but none of the style sheets or javascript are loading. I'm clearly doing

Mod rewrite Rewriting CNAME subdomain

I have a sub domain that I want to redirect to a different location using mod_rewrite. For example: -> I don't want to send a redirect to the browser though (so it doesn't know the page is different). BTW has a CNAME record pointing to Edit Another example, just to clarify. It is very simple: If is entered in to the browser, Apache returns the contents of

Mod rewrite Force SSL/HTTPS with mod_rewrite

I have a Zend Framework application that I want to force into HTTPS using mod_rewrite. I am pretty lost when it comes to mod_rewrite. Here is my current .htaccess file in the root of my application. RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-s RewriteCond %{REQUEST_FILENAME} !-l RewriteRule !\.(html|htm|php|js|ico|gif|jpg|png|css|csv)$ /subdir/index.php What is the best way to force the application into HTTPS base

Mod rewrite Having problems with a Rewrite rule

I have an application most of it is still in development that's why i need to block access on all pages but just not two of them. Suppose i have a.php all requests will be redirected to here except b.php. So i think there should be 3 rules: 1st: when a.php and b.php are requested they should be visible to user, 2nd: if anything other than those two is requested, it should be redirected to a.php. 3rd: for external css,javascript and image files there should be an access rule Si

Mod rewrite Redirect folder link to xml file

So I recently switched away from wordpress. Wordpress keeps all of it's feed URLs at /feed/. This seems reasonable to me, so I never signed up for a site like feedburner. Now I'm using an entirely new blog software, and it puts the feed at /atom.xml. How can I use the .htaccess file to redirect requests to /feed/ to /atom.xml? Or maybe redirect requests to both to a feedburner url?

Mod rewrite mod_rewrite: Why does apache URL-encode %{HTTP_COOKIE}?

I am trying to match a value in a cookie. The problem is, Apache makes the value url-encoded. So, if I do this: RewriteCond %{HTTP_COOKIE} ^(.+)$ [NC] It will capture this: session%3DeXnR1oDL1Reb8Z3Gdgk7Sg%26account%3D2%3B instead of this: session=eXnR1oDL1Reb8Z3Gdgk7Sg&account=2 So there is no way to get the account number to do this: RewriteRule ^$ /accounts/%1/ [R=301,L] Please help! I have looked everywhere on Google and stackoverflow and no one has addressed this issue. Than

Mod rewrite URL re-write syntax

I have a URL: "" I want to re-write this url as below: "" I tried to do this by writing this below code in .htaccess but not getting any luck. RewriteEngine on RewriteRule ^$ /Model/Public/Home/ RewriteRule ^buynow/([0-9]+)/?$ Model/Public/BuyNow/buynow.php?str=$1 Please give me write syntax. Regards

Mod rewrite Pulling my hair out with mod_rewrite and MAMP

I'm using MAMP and I can't get mod_rewrites to work. After lots of playing with numerous http.conf files and then finally looked at my php_info, there is no mod_rewrite exstension installed. I opened up the php.ini files in Applications > MAMP > conf > php5.2 & php5.3 and looked at the exstensions and there was no All I can see is:

Mod rewrite url rewriting doesnt work for pages in subdomain

I need to change to with url rewriting. Here is my code in .htaccess (placed in abc folder) Options +FollowSymLinks RewriteEngine on RewriteRule /xyz/([0-9a-zA-Z]+) /xyz.php?id3=$1 I'm using a hosted server. also tried without Options +FollowSymLinks but still doesn't work. appreciate any advice from someone please.

Mod rewrite Explain this rewrite rule

Could somebody explain these rewrite rules in English please so I can get a better understanding of the syntax - my initial understanding is the following: If the URL starts or ends with a slash then display RewriteRule ^/$ [P,L,QSA,NC] If the URL starts with a slash followed by a string not including a slash then a dot and not including another string with a slash then redirect it to$1 RewriteRule ^/([

Mod rewrite Use a sub domain to act as a folder

I have this code: # Use WordPress subdomain RewriteCond %{HTTP_HOST} RewriteCond %{REQUEST_URI} ^/wp/(.*)$ RewriteRule .* [L] This works, exactly how I want it to, so when you go to it shows the page However, rather than it redirecting you in the browser to the physical address I would like it to display Is that possible? Thanks, Ian

Mod rewrite mod rewrite rule for parameters

I have below url(s) i would like to permanently redirect above url to using .htaaccess file. (apache server) please also consider there are few other urls there but i dont want to touch can anyone please help me. thank you in advance.

Mod rewrite mod_rewrite disallow call of subfolder

I am using 2 Domains like and The shortning URL calls only generated URL's from my Script. All other calls from the shortning URL should be forwarded to the Main Domain. Thats why I have this small mod_rewrite Rule. RewriteCond %{HTTP_HOST} ^ [NC] RewriteRule ^/?$$1 [R=301,L] The Question I want to disallow calling subfolders from the shortning URL. Because the shortning URL can also generate Custom URLs like

Mod rewrite Mod_Rewrite Masking Fails on Protocol Switching

Firstly let me tell you im greener than green when it comes to mod-rewriting this might be normal behaviour but i am looking for a way to stop it. RewriteRule ^Network-Status/$ ./serverstatus.php [L,NC] This is my Rewrite rule, What i expect this to do is simply redirect to serverstatus.php while still masking the url which it is doing perfectly well, however serverstatus.php is forced non-ssl i cant change this and a protocol switch from ssl to non-ssl is breaking the url masking. I could l

Mod rewrite accept parentheses as a character in mod_rewrite

i have to redirect some old page to new page i used below commend in .htaccess RewriteRule ^Savane-98.htm$ savane-tc-9347-41-belgian-tapestry-throw [R=301,L] it works fine but some of my old link have parentheses '()' it don't work how can i solve that . like below link RewriteRule ^antique-bronze-square-end-rod-(flat-to-wall)-tapestry-wall-hanging-rod$ antique-bronze-square-end-rod-flat-to-wall-tapestry-rod [R=301,L] this link don't work can anyone help me Thanks

Mod rewrite Using "?" when rewriting the URL

I have been researching for weeks now looking how to rewritting this file/directory with a complementary "?" or "question mark" What I need: to look like: theme > is just a simple directory I need to use for my websites products(in this case themes) jerus > it is simply the name of the theme Extra Info: I plan on rewritting every URL individually so refrain from wildcard varibles.**

Mod rewrite Joomla 2.5 404 on inner pages

I just downloaded a remote copy of Joomla 2.5 site, and when working in localhost any of the internal links work. Home page and administrator work ok but internal pages return 404 not found Local site runs PHP 5.3.21 on Apache 2.2 under Windows (server is linux), SEF and mod_rewrite is enabled and htaccess works on other local sites so I guess it should be working. My hosts file has an entry for this domain and set up a virtual host so URLs are exactly the same in localhost and in the server.

Mod rewrite mod_rewrite: strip away subdomain and convert to URL parameter

I have a web app, where I keep a subdomain for every client eg: Due to some server hazzling I have to forward this stuff to my new server at http://123.456.78:1002/clientNo32/app/index.php The folder "clientNo32" does NOT exist, it's only a parameter I want to get from the URL. How can I achieve this?

Mod rewrite mod_rewrite, old URLs to new URLs

Migrating a site and trying to preserve some bookmarks and search results Old URL topic/0/14.php New URL Module/news/filter/topic^sub^10282/page1.htm Seems like this should be pretty straightforward, and I've tried but RewriteRule ^topic/0/14\.php /Module/news/filter/topic^sub^10282/page1.htm? [R=301,L] results in a redirect that goes to^sub^10282/page1.htm ... in other words, the redirect contains the full URI,

Mod rewrite using mod_rewrite to redirect from subdomain to maindomain

My problem is that i have a functioning subdomain ( sub is loaded in What i would like to do is to redirect all requests to to Somehow it seems that when im the subdomain i cannot access the rootfolder (main domain). I can get it working with from to But not from the subdomain. Currently im using: RewriteEngine on RewriteRule ^(.*)/?$ /home/web/webuser/$1 [L] When accessing

Mod rewrite Rewrite rule to strip part of a url

How you you write a Rewrite rule in .htaccess to redirect all urls with the word test and (any strings after it) e.g. /test/spiderman?id=something or /test/spiderman To the same url with the test part removed e.g. /spiderman?id=something ps A simple request to /test/ would not match because there are no strings after the word /test/

mod-rewrite domainA to domainB with parameters or individually redirect

I have a old domain with a old url structure and want redirect (301) it to an another domain with a new url-structure. I have urls that must be transform individually: => => => another urls have the same values: =>

Mod rewrite Ignore urls that have no parameters in robots.txt

I have a pretty url like this. I want to disallow the url if there is no shoes parameter in the url because without the parameter the page will be redirected to homepage. So i tried something like this in robots.txt file Disallow: /category/ Allow: /category/*?* I am not sure if the above attempt is correct or not? Or what is the correct way of achieving it?

Mod rewrite mod_rewrite redirect 301 for /?install

I am struggling to redirect an install path using .htaccess so that it is not accessible. I do not want to modify the PHP code and it is not possible to disable install. It is just showing server settings - you cannot change any settings. But I want to hide this information from the world. This is the URL I want to redirect: and I want to redirect it to: I already tried Redirect 301 install / without success. I guess it has to do with? install i

Mod rewrite Stop Mod_Rewrite execution on matching RewriteCond

I am running the free version of Helicon ISAPI Rewrite on IIS and have several sites running through the same set of rewrite rules. Up 'til now this has been fine as all the rules have applied to all the sites. I have recently added a new site which I don't want to run through all the rules. Is there any way to make requests to this site break out of the rule set after it's executed its own rules. I've tried the following with no luck; all requests to result in a 404. I guess what I'

Mod rewrite Should I set rewrite rules on an ASP.Net MVC site with heliontech IISRewriter Globally or by folder with wordpress?

I'm using IIS6 (unfortunatly) and have built an ASP.Net MVC app; IIS is set up for wildcards to make the routing work but I have two virtual directories that contain wordpress installations which works fine. I have two .htaccess files (one in each wp install) that handles their rewriting fine, but I want to setup a rewrite from /about to /blog/about. How would I do that and is it better to create all the rewrites in one .htaccess at the root of the site?

Mod rewrite Isapi Rewrite : Remove filename from URL

Im am trying to use the isapi rewrite tool on my web domain to write some basic rules, but am getting a bit confused. My base url is and every page on the site follows from this base url. For example would be the artist page for blondie.. What I am looking for, is a rewrite rule, that would remove the index.cfm from the url, instead leaving

Mod rewrite Rewrite rule to handle IP address urls

I want to direct all traffic that comes in via an explicit IP address to one particular domain. I have applied the following rewrite rule, but it's losing any path/query variables: RewriteCond %{HTTP_HOST} ^$ RewriteRule ^(.*)$1 [L] For example: should be directed to, but instead it's being rewritten as

Mod rewrite mod_rewrite to shorten url files path

I am having a bit of difficulty getting mod_rewrite to do what I need it to do. We have a group of virtual subdomains in a Drupal install. So,,, etc are all part of the same core Drupal install. File access currently is However this path will also work as or any other valid subdomain. We'd like to use mod_rewrite to accept

Mod rewrite apache mod rewrite with the_request

I want to do the following with apache (mod rewrite). if the user requests http://hostname.tld/index.php/folder/subfolder i want it to redirect (with a R=301) to http://hostname.tld/folder/subfolder. if the user requests http://hostname.tld/folder/subfolder the request should internally be rewritten to index.php/folder/subfolder. To prevent an endless redirect the first rule should check for %{THE_REQUEST}. The problem here is that I am unable to append "folder/subfolder" with a regex. How s

Mod rewrite mod_rewrite but skip a directory

I'm attempting to avoid urls like this one: images/ or images/valid-filename.png or images/invalid-filename.png from being rewritten and I've checked other example questions like .htaccess mod_rewrite on root directory but need it to skip all other directories and .htaccess mod_rewrite exemptions and this one but I've not managed to get the rules to achieve what I'm after. Here is what I have right now: # Enable U

Mod rewrite "If" - "Else" in Mod Rewrite

I've been searching and testing for 3 hours and no luck. Hopefully you al can help me. Here is my code: AddHandler php-legacy .php <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_REFERER} ^http://www\.google\.com [NC] RewriteRule [R=301,L] </IfModule> <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine on RewriteRule ^$ [R=301,L] RewriteCond %{HTTP_HOST} .* RewriteRule ^(.+)$ htt

Mod rewrite Compare and rewrite URL with mod_rewrite based on path and query string

I have URLs in a scheme /([0-9]*)/some/path/script.jsf?someId=([0-9]*) and I'd like to redirect to $2 the user if $1 doesn't match $2. So for example if the user requests /1/some/path/script.jsf?someId=1 everthing is fine and the user shouldn't be redirected but if the user requests /1/some/path/script.jsf?someId=2 the user should be redirected to /2/some/path/script.jsf?someId=2 I've tried this rule: RewriteCond %{REQUEST_URI} ^/([0-9]*)/ RewriteCond %{QUERY_STRING} someId=([0-9]*)

Mod rewrite 301 redirects from old URLS to new ones

I am redesigning a clients' old website to look better. They built a website themselves with very strange URLS. I have looked everywhere for the answer and I have achieved some success but not all by using 301 redirects. They had urls like website/name ++.htm and I need to do a 301 redirect to website/name.php Is there anyone that knows how I can 301 a URL that has a space ++.htm in the name. Thanks

Mod rewrite Problem with RewriteCond %{QUERY_STRING}, backreference not dispaying in final URL

I have the following in my .htaccess file: RewriteCond %{QUERY_STRING} ^route\=product\/category\&path\=35\&page\=([0-9]+)$ RewriteRule ^index\.php$ http://%{HTTP_HOST}/product/category/35/page_$1? [R=301,L] It's not behaving as expected though, when I enter the URL: It gets rewritten to: Could someone tell me what I have done wrong please? Thanks, eb_dev

Mod rewrite Apache url rewrite rule

I need to configure a specific url rewrite configuration I can't figure out. Just wonder if anybody can help I need to rewrite* to htpp://* I really hope that this is possible ... Thank you, Pavel

Mod rewrite Change URL in address bar but keep on same page

Is it possible to rewrite a url so that the page stays the same and the url itself is chanaged ? E.G.: I have a page at I want this url to appear in the address bar as I am NOT trying to redirect a page at to ANOTHER page at ....There is only ONE page - it is just the URL I am trying to change so that if a person types in, they will go to that page but the URL

Mod rewrite Apache - Rewrite url without loop

Well I say what's said in the title again, I can't find a way to rewrite all my urls without getting a loop. I've tried many options but I can't find about one way which avoid a redirection loop: RewriteRule ^/(.+)$1 [R,L] RewriteRule ^/?(.*) /var/www/example/index.php$1 [R]

Mod rewrite Redirect to alternate url using the variable declared after first slash

Ok, Ive checked this site and still I am confused about how to do this... I need to take a url like this and redirect to a url like this http://assets.subdomain.domain/php/store.php?store_num=1234 utilizing the numbers after the slash as a get variable Here is what I have in my .conf file so far. <VirtualHost *:80> ServerName ServerAlias* VirtualDocumentRoot /var/www/html/prod/

Mod rewrite simple mod_rewrite is removing my query string

I have spent a fair amount of time in the apache documentation, on google and on stackoverflow and I cannot resolve my issue. Here is some background: I am storing images in a database in a blob format. I have a script called imageRender.php that accepts the name of the image as a query string and echos the image within an image tag. <img src='/script/imageRender.php?name=foo'/> In order to simplify the src attribute I am attempting to use apache mod_rewrite to map a simpler src to the

Mod rewrite Erica CouchDB rewrites

When I upload documents using Erica into CouchDB it removes my rewrites. Is there a way to configure my rewrites in Erica? If so I've been unable to figure it out, any help would be great!

Mod rewrite mod_rewrite / htaccess error after rewriting url

I have a website which I am trying to implement url rewriting for tidy looking urls...the problem I am having is that when a visitor goes from my index page to the venues page, when they try to come back to the home page I get a 404 error. My link looks like this: <a href='venues/a-venue'>A VENUE</a> My rewrite looks like this: RewriteRule ^venues/([A-Za-z0-9-]+)?$ venues.php?venue=$1 [L] This works absolutely fine, and loads all the necessary JS/CSS/image files etc - but when

  1    2   3   4   5   6  ... 下一页 最后一页 共 8 页