mod-rewrite

help rewriting this url. simple but not working.

RewriteCond %{REQUEST_URI} !^/?ping.php RewriteRule ^/\?(.*)$ ping.php?url=$1 [L] i am trying to match any character that follows /? www.mysite.com/?someurl.com instead it keeps loading the index.html ! ...

how to rewrite this simple url ?

how can i rewrite www.mysite.com/someURLhere into www.mysite.com/ping.php?url=someURLhere without mistaking local files, and directories as domains. so i dont want www.mysite.com/index.php www.mysite.com/admin/ to rewrite to www.mysite.com/ping.php?url=index.php www.mysite.com/ping.php?url=admin/ ...

PHP how to treat nonexistent URLs on a single entry point site that uses mod_rewrite

I am developing a web site in PHP and I am using mod-rewrite to implement a single point of entry in index.php. From there I am using a dispatch table to dynamically create content for each URL (can be from a DB or other means). I am not sure what is the correct way to treat URLs that are not in the dispatch table. I would like to retu...

Using mod_rewrite to redirect 70+ URLs with variables

I am constructing a webcomic site, but the chapter order has changed significantly. I have manually written the conversions for myself in a form like this: 36 -> 26.1 37 -> 28 38 -> 28.1 39 -> 29 40 -> 30 41 -> 30.1 Basically, following this guide, I want to convert all urls like http://ww...

ISAPI Rewrite rule help (http://www.foo.com/bar --> http://www.foo.com/bar.aspx)

A really easy one, but I need to get this right, and cannot afford mistakes as I need to deploy on a live server as soon as I can. http://www.foo.com/bar --> http://www.foo.com/bar.aspx http://www.foo.com/bar?q=boo --> http://www.foo.com/bar.aspx?q=boo # I only want /bar to get rewritten to /bar.aspx # everything else stays as is http...

Using mod_rewrite, how do I force the path and query string to be all lower case?

This seems like it should be an easy thing to do, but for the life of me I can't figure this out. I want to force my entire URL to be in lower case, so that, for example: http://www.EXAMPLE.com/foo?q=bar http://www.example.com/FOO?q=bar http://www.example.com/foo?Q=BAR http://www.EXAMPLE.com/FOO?Q=BAR all (301) redirect to: http://w...

mod_rewrite, put wordpress in sub-dir on server seamlessly?

I use wordpress for personal blog. Now I want to make it my personal website. Hence, I'd like the URL to be mysite.com rather than mysite.com/blog (e.g. mysite.com/2009/10/blog-entry rather than mysite.com/blog/2009/10/blog-entry) A simple way is to move /blog/* to /blog. But this will make Wordpress files mess up with existing files I ...

internally redirecting to another file in Apache

Hi, I want that a url http://domain.com/sitemap.xml internally points to a file sitemap_book.xml in htdocs without any 301/302 redirects. Please suggest a Rewrite Rule for the same. I came up with RewriteCond %{REQUEST_FILENAME} "sitemap.xml" RewriteRule ^(.*)$ sitemap_book.xml [R] but it doesn't work without [R]. Gives 400 ...

$_FILES array in PHP is empty...

I'm trying to get a file uploaded through a PHP script, but my $_FILES array is always empty? My $_POST data entry for the file HTML input element has the filename...Just no file is created on my local system. I've verified write access to the temp folder and explicity set it. I've checked phpinfo() to make sure file uploads are enabl...

mod_rewrite: do not apply here

I am using mod_rewrite to put a category name in the URL, like locahost/categoryName and also a location localhost/categoryName/locationName . One question I had, and I'm sure it's easy to do as a rewrite rule, is how can I make it so that the rule does not apply to some specific directory, like: localhost/admin . In that case I want it...

Apache mod_rewrite question

Hi! I have an application running under tomcat 6. In front of it I have an apache server which is forwarding all requests. That is, the user "talks" to the apache and not to tomcat. For some reasons the it is requested the following: when the apache server receives a request of the form http://www.mydomain.com/myApp then it has to ...

Apache - Prettifying URLs with mod_rewrite while also catching some edge cases

Sorry to bug everyone with another mod_rewrite problem but you know the drill. Basically, I have viewer.php, which accepts two arguments, chapter and page. Sometimes people will request a chapter only, and sometimes they will request a chapter and page. i.e. viewer.php?chapter=10 or viewer.php?chapter=10&page=5. The php is smart enough ...

mod_rewrite params inversion

How can I create the mod_rewrite rule so I can convert the following URLs: From: domain/something/param/action ex:domain/cities/Chicago/view to: domain/something/action.php?param1=param ex: domain/cities/view.php?city=Chicago Changing to cities/view/Chicago cannot be an alternative. Thanks in advance. ...

htaccess rewrite not working for all rules

This is a very strange problem, and I just hope that I can clearly explain it. Basically, we made a major update on a client site today, and needed to update some rewrite rules in the htaccess to accomodate the new structure, etc... So, where we originally had things like: RewriteRule ^/resources/?$ index.php?id=resources RewriteRule...

Rewrite Rules Behavior Changes When Used Together

Each rule set below works fine when used alone. However, when used together, the rules' behavior changes. When rule set # 2 is used by itself, a request for https://internal/Security/login is rewritten by Apache to sapphire/main.php without the browser's knowledge. This is the expected behavior. When both rule sets are used together,...

Rewrite parked domain to subfolder on primary domain

I am having a ridiculously difficult time getting an Apache Rewrite rule to function as intended. Wondering if anybody could help me spot the error. I am trying to rewrite a parked domain to a subfolder on the primary domain without changing the browser address bar url. RewriteCond %{HTTP_HOST} ^domain-name\.com$ [NC] RewriteRule ^/...

How to redirect old "ugly" urls to seo-friendly ones?

Hi! I'm new to mod_rewrite and need to do something for my client. Suppose I have the www.mydomain.com/products.php?prod_id=32. This product has a section (clothes) and a name (shirt). These names and sections are unique. In a SEO-Friendly Url, it should be www.mydomain.com/products/clothes/shirt/. I know I can create RewriteRule ^...

htaccess rewrite and auth conflict

I have 2 directories each with a .htaccess file: html/.htaccess - There is a rewrite in this file to send almost everything to url.php RewriteCond %{REQUEST_URI} !(exported/?|\.(php|gif|jpe?g|png|css|js|pdf|doc|xml|ico))$ RewriteRule (.*)$ /url.php [L] and html/exported/.htaccess AuthType Basic AuthName "exported" AuthUserFile "/hom...

What's wrong with this rewrite rule (redirect a directory request to another server)?

I'm try to redirect any request to mydomain.com/video/(.*) to video.mydomain.com/$1. I have the following rule: RewriteRule ^video/(.*)$ http://video.mydomain.com/$1 [R=301,L] But it doesn't seem to work. Instead it follows an additional rewrite rule which I have later which redirects all requests to index.php. ...

Un obfuscate URL using mod rewrite.

I work for a company that used to have a polocy of obfuscating URLs for articles which you needed to register to use. So they would have something like /story.php?story_id=Z_ZXYZ which there was some code which mapped letters to numbers to work out the true story id so Z = 0 Y = 1 X = 2 etc. We are now moving technology stack and...