mod-rewrite

Combing a symlink to an external folder with a Rewrite Rule?

I've created a symlink in an account to an folder external to that user account (although with the same ownership). The symlink works but I'd like to combine it with a RewriteRule, and I'm having problems with that. For instance I create the symlink with: ln -s /home/target shortcut And I add the following RewriteRule to .htaccess: ...

Apache Mod Rewrite - Replace : character with another

I'm trying to rewrite all URL's that contain a ':' in it to another character. http://en.wikipedia.org/wiki/Filename#Reserved%5Fcharacters%5Fand%5Fwords Example: http://example.com/some_interesting:info http://example.com/some_interesting_info http://example.com/some:interesting:info http://example.com/some:interesting_info would al...

Solving trailing slash problem for a given setup

Hello, Considering the following rules, how can I rewrite them in order have a trailing slash? I have to mention that I can only edit the .htaccess file, so I have no access to modify the URLs in the website. RewriteRule ^artists/(.*)-p(.*)$ /artists.php?l=$1&p=$2 [QSA,L] RewriteRule ^artists/(.*)$ /artists.php?l=$1 [QSA,L] RewriteRu...

nginx rewrite - one more time

Assuming I've got a rule which looks like this: RewriteCond %{HTTP_HOST} app_name RewriteCond %{REQUEST_URI} !^/application/app_name/index.php RewriteRule .* /application/app_name/index.php/$0 [L] I've tried to convert it to nginx equivalent but i've failed :-) Here is my implementation (broken) if (-f $request_filename) { break; ...

URL Rewriting/Redirects with Querystring?

We have a situation where I have a bunch of urls with query params that are used to bascially redirect to various sites, kind of like a short URL or index. Ex: www.mysite.com/abc?x=123 which redirects to www.google.com www.mysite.com/abc?x=456 which redirects to www.yahoo.com and so on... The issue is that there isn't an actual pag...

RewriteRule on special querystring

My URLS the page names example: ?Contact- or ?Product- some have a longer querystring example: ?Contact-&go=Admin domain.com/?Contact-&go=Admin I would like a RewriteRule to use domain.com/Contact/Admin thanks ...

rewrite urls with GET reqs

Hello, how do I configure my .htaccess rewrite rules to accomodate GET requests? Currently, /manager/page goes to: ?dept=manager&n=page however, some pages have additional GET reqs, and so this rule doesn't work: RewriteRule ^([A-Za-z]+)/([A-Za-z]+)$ index.php?dept=$1&n=$2 [QSA] I would need: ?dept=manager&n=page&id&etc=etc to go to:...

Using relative URLs with mod_rewrite

Environment: Apache 2 shipped with Mac OS X Leopard; with no big changes in the default httpd.conf. I am setting up some rewrites through my .htaccess but I am not able to use target paths relative to the current directory. # URL: http://localhost/~davis/rewrite/.htaccess # File: /Users/davis/Sites/rewrite/.htaccess RewriteRule go.php...

How to redirect request coming from a domain to a subdirectory invisibly?

Hi, I am trying to redirect all requests coming from example.com to a subdirectory. The code below accomplishes this but I cannot make the subdirectory invisible. (The subdirectory contains a Drupal instance with its own/htaccess file. Could that be the problem?) RewriteCond %{HTTP_HOST} ^example.com$ [NC] RewriteRule ^(.*)$ http...

Mod-Rewrite Question

Hello, I want to make a category path with pagination. URL's would be as followed; All paths should work with or without trailing slash (if possible) /category/entertainment-and-music/ /category/entertainment-and-music/music/ (represents "music" category "under entertainment and music") /category/entertainment-and-music/5/ ...

mod_rewrite does not return $_GET-value?

Hello. I have a problem with mod-rewrite, to be more precise, it doesn't redirect me properly. Everything works fine on my local server, the problem only occurs when the site goes live... This is what I have in the .htaccess: Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteRule ^(tutorial|news|out|profile|script)/([0-9]+)...

Mod rewrite including punctuation?

I've come across a bug in my site: basically, it won't allow page names with full stops (periods) in them. I know the root of the problem is in my .htaccess file. RewriteEngine on RewriteRule ^([^/\.]+)/?$ index.php?section=$1 [L] RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?section=$1&page=$2 [L] RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\...

mod_rewrite - change URL case

Is there any straightforward way to change the case of any URL using mod_rewrite? I thought this was pretty trivial... apparently not. Examples: http://example.com/id to http://example.com/ID http://example.com/id/123 to http://example.com/ID/123 and so forth. ...

htaccess 301 Redirection for Multiple Files

I'm wondering if multiple entries on htaccess will work for 301 redirects. The problem I see is that old site files have 'html' extension and are named named differently so a simple global redirect won't work, it has to be one rule per file name. This sites receives 1000 visits daily so need to be careful not to penalize search engine....

mod_rewrite rules, how to test for 'not a string' ?

I have a blog installed in www.foo.com/wp/ and would like all requests that go to any page that doesn't start with /wp/ to be redirected to www.foo.com/wp/ (without preservation of the URL). E.g.: www.foo.com/bar/baz/hello.gif > www.foo.com/wp/ Also, at the same time, I need the URL to have www. added if it doesn't (which might b...

Redirecting root only via .htaccess with other rules in place

I have an installation of YOURLS that redirects generated addresses to a different domain, however the root does not redirect. How can I set a rule that cooperates with the existing rules to achieve this? Here's the .htaccess file as it stands: # BEGIN ShortURL RewriteEngine On #RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteC...

Redirect old permalinks (page_id=x) wordpress

I used to have my permalinks to standard format, something like http://example.com/?page%5Fid=2. Now I have changed this, using ISAPI rewrite in a httpd.ini file in the wp root folder. This is working, but I need to have the old page_id=x style pages redirect to the current permalinks which is in a form of http://example.com/subject. I ...

Apache - Rewrite Rule confusion

Redirect 301 /resort.php/FOO/BAR http://www.sitename.com.com/index.php RewriteRule ^/direct/(.*) /direct/$1 [QSA,L] # access non i18n files directly RewriteRule ^/([a-z]{2}\/.*) /$1 [QSA,L] #any language subdirectory should be left alone RewriteRule ^/(.*\/$) /en/$1index.php [QSA,L] #fix for links ending in / Rewrite...

Help with mod rewrite redirecting to new url

Hello, The following url rewrite works fine but it doesn't redirect to the new url. RewriteRule ^test-(.*)-(.*)\.html$ /test.php?&abc=$1&xyz=$2/ [L] ...

Nginx clean urls rewrite for Mediawiki

I've done my best to research and try solutions I've found before posting this, hopefully it will help others also. I'm trying to write urls in Mediawiki to domain.com/PageTitle (I know this is bad practice). I've gotten it 99% working with this: http://snipt.org/msh (off a tutorial for drupal so might be completely wrong for my purpo...