mod-rewrite

Domain routing to directory, .htaccess or DNS-magic?

I have three domains of the same name with tlds: .com, .de and .ru. Can I route the visitor depended on tld he had choosen? As example: test.com routes to /english/ directory, test.de to /german/ directory, test.ru to /russian/ one. I have full access to the server. ...

.htaccess and mod_rewrite

Have the following mod_rewrite rule: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php RewriteRule ^index\.php$ / [R=301,L] </IfModule> Which strips .php from any of my urls. However, if I try to specify a 301 redirect to...

Rewriting URL's with Mod_Rewrite

Original Question: what could be the mod_rewrite, to rewrite urls with this structure: http://hiwis.net/jobs/Computer/ to something with this structure: http://hiwis.net/Computer/ -- I need some help with the mod_rewrite for my hiwis(dot)net site to rewrite urls with this structure: hiwis(dot)net/jobs/Computer/ to something with t...

Simple mod write

I have a simple mod_rewrite question. What do I need to write in the .htaccess file to have: http://www.example.com/index.php?route=account/login I want the URL to look like this http://www.example.com/account/login Thanks. ...

Writing a basic PHP MVC, not sure how to start...

I am working on a personal project based in PHP and MySQL, and I am doing a bit of research and playing around with rewrites. Say I have a site... http://www.myDomain.com/ And I want to have an index.php, or bootstrap, in the root of the domain. So if you access... http://www.myDomain.com/admin/ It will still load from the index.ph...

Htaccess help, $1 being used before its set??? what?

I have this snippet RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index\.php|images|img|css|js|robots\.txt) RewriteRule (.*) index.php?/$1 [L] It won't allow me to access a file at website.com/js/main.php but it will let me access index.php According to my webhost, $1 is...

htaccess mod_rewrite help

i have a domain with a website in a folder. i.e http://domain.com.au/website/page.php i only have access to .htaccess files to make the rules. i would like my url to look like this.. http://domain.com.au/page so in essence i want to drop the subfolder its sitting in, and the php extention. All links in my php are structured like thi...

Help me rewrite this htaccess rule

How do I rewrite this rule to redirect everything back to the index or server_root? If there is a request for say, www.site.com/articles/some-article.php, the somearticle.php should be re-routed back to the index page. I also don't want to have the url showing the "index" portion of the URL. site.com/index is where everything should be ...

Mod_rewrite: Direct everything to one PHP file

I have this rule: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !index.php RewriteRule ^(.*)$ index.php?req=$1 </IfModule> Everything works fine if I request non-existing directories like myhost/view/blah, but when i enter some existing directory in the url like myhost/module I get redirected to module...

how do i hide /magento/ in my site's url?

A site has an existing system (lets call it mysite) and the client asks to put in magento. My directory structure goes something like this: ROOT -index.php (this is the app's main controller) -.htaccess /blog (runs wordpress) /assets (current system's media folder) /magento (this is where all magento files go) P...

.htaccess mod_rewrite for nested folder structuring

Hello, I recently found an article online that told me about this: RewriteRule ^mock-up/([^/]+)/([^/]+) /mock-up/index.php?page=$1&section=$2 [NC] Only thing that is driving me crazy right now is if I want to be able to have the 2nd directory or not. Like: RewriteRule ^mock-up/([^/]+)/([^/]+) /mock-up/index.php?page=$1&section=$2 [...

How can I redirect one wordpress install to another (both in subdirectories on the same domain)?

Pulling my hair out over this one. I have one wordpress install at /2009 and one at /2010. I am trying to redirect all requests to the 2009 site to the 2010 site. I have tried both of these in the root .htaccess and in the /2009 .htaccess: RewriteRule ^2009.*$ 2010 [R=301,L] RewriteCond %{REQUEST_URI} ^2009.*$ RewriteRule . 2010 [R=3...

Redirect Form Get Request With RewriteRule

Okay, so I have a website where the user can put a search query into a form that uses GET to send the data. When it gets sent, the url looks like: /recipes.php?query=taco&ingredients=chili And I would like to rewrite it to look like: /recipes-taco-Ichili.html So I added the following line to my .htaccess file: RewriteRule recipes\.php...

What is a mod_rewrite rule to turn *.html to *.php?

I need a rewriterule so if i type index.html i will show index.php I mean i have files like, home.php, about.php and i want to be able to access them with .html too Thanks in advance ...

How to stop strings appending to URL rewrite?

Hi, I've implemented a simple .htaccess to rewrite any request on a particular directory. It works to an extent. If you request with nothing after the trailing slash, then it redirects fine. If you put anything after the trailing slash, it is appended to the end of the URL you're trying to re-direct to. For example, You request: /...

Apache Mod_Rewrite query string to standard url

Hi there, I was using a .htaccess redirect 301 to redirect a URL which then appended all the query string elements to the end, leaving me with some URLs indexed in Google as /store/product/?d=department&s=section&p=product. I have fixed the redirect by using a RewriteRule instead which doesn't append the query strings, however I'm stuc...

RewriteRule without changing the address in the browser

I'm trying to make an address redirect to another one without actually changing the URL in the browser address bar. User go to /path/page.php and see what is displayed on /path/index.php. In the address bar the URL remains /path/page.php. This is the code for the redirection: Options +FollowSymLinks RewriteEngine On RewriteRule page....

mod_rewrite and relative urls

I'm setting up some simple url rewriting rules using mod_rewrite and a .htacces file, but I've got some problems. If I set up the .htacces this way: Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteRule /index.html /index.php [L] when I call from the browser this url: http://localhost/~dave/mySite/index.html I got a 404...

.htaccess mod_rewrite is preventing certain files from being served

i have a successful use of mod_rewrite to make a site display as i wish... however, i have migrated the 'mock-up' folder to the root directory and in implementing these rules for the site, some files are not being served in the ^pdfs folder: RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^ - [L] (old directory) RewriteRule ^redesign_...

how do I redirect a user to a certain page using .htaccess

I have the following rule defined in the .htaccess file of my webapplication's root directory. RewriteCond %{REQUEST_URI} !^/classes/captcha.php RewriteRule ^([^/]*)/([^/]*)$ /index.php?client=$1page=page1 Now what I want is that when a user types in http://xyz.com/abc/page1, the address bar of the browser should display the origina...