mod-rewrite

Redirect URL with RewriteRule if php url has parameters?

Hi, I'm trying to use rewrite rules in my .htaccess to take user from an old link to a temporary new link (it's not a permanent new site, so I don't want a 301 redirect) The following works for all the html pages and also the php pages without parameters, but it doesn't process the last example - a php page with parameters. Note that t...

Rewrite .htaccess regex url

I have an .htaccess file with this: (I didn't write it) RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?bla=$1 [L,QSA] Problem URL http://localhost/index/test The "index" part seems to match "index.php" that's in a web dir and Rewrite fails. Question: What's wron...

Why is rewritebase neccesary when rewriting url via .htaccess?

rewriteengine on rewriterule ^/a/b$ ^/c$ not working,but rewriteengine on rewritebase / rewriterule ^a/b$ ^c$ works. ...

.htaccess and custom ErrorDocument for different file types.

I'm wondering if it's possible to use mod rewrite along with the ErrorDocument deceleration to customize the error pages depending on what type of file is requested. For example a non-existent html or php file is requested Apache will give nice custom HTML page. But if a non-existent image, js, css, etc... file is requested then Apache...

Temporarily route all traffic (new site) to other domain? Best practice?

For a client I need to temporarily route their traffic to my own subdomain. Their host (a shared host) needs to be reconfigured for the site to work, but the client wants their site online ASAP (what else is new ;-) Considering the following: It's a new site/new domain, so there is no legacy SEO traffic. Preferably I'ld like the c...

url rewrite problem wamp

hi i have login.php , for that i have created the url rewrite in the .htaccess inside the login folder , RewriteEngine On # Turn on the rewriting engine RewriteRule ^login$ login.php [NC] # Change feed URL but nothing happened , what i do now , am using wamp.. ...

rewrite_mod help

Dear all, I need some help about rewrite_mode, this is my wordpress address: http://localhost/my_v2010/restaurants?m=display_Add base_url: http://localhost/my_v2010/ post_name:restaurant query string:?m=display_Add I would like to use rewrite mode, let user just type http://localhost/my_v2010/restaurants/display_Add any clue ho...

How to redirect myurl.com/targeturl.com to to myurl.com/?site=targeturl (PHP/Apache/Linux)?

Hi, I'm writing a website that allows people to asses a web page's readability (Flesch-Kincaid Reading Ease, thank kind of thing). Ideally I'd like the user to be able merely to preceed the target URL with mine (like many mirror sites do), and hey presto they can see the results. I'm guessing it's got to be done with mod_rewrite, but...

mod_rewrite incorrectly escaping characters

Hi there, tried to find the problem for this but nothings really working. Basically, I'm trying to use the following regular expression: RewriteRule ^course/filter:([a-zA-Z0-9_-\,\=]+)$ php/manage_courses.php?display=list&filter=$1 [L] however I get a 500 error and this in the error log (note the escaped chars): [Wed Jan 27 16:29:3...

How to handle and identify multiple sub-domains

Hi, I am planning for multiple sub-domain names based on city, something like city1.mydomain.com, city2.mydomain.com, ... All sub-domains will point to same file structure on main domain. Then in my program I would like to capture the city name and display content based on city. What is the best approach to identify the city (based on ...

Forcing mod_write to not rewrite anything ending in .css or .js ...

I have a very simple rewrite rule. It basically takes everything and sends it to index.php. That rule works, but as you can guess any request to an image, css file, or js file gets redirected also to the php page. So i tried adding conditions, but they dont work at all: RewriteCond %{REQUEST_FILENAME} !(^.*css$) RewriteCond %{REQUEST_F...

.htaccess redirect all filenames matching...

I want to redirect certain filenames to a different filename for a site regardless of directory. The idea is I have a cached, versioned filename for production, but when I am working on the file in development I want my local files without having to rename all references. For example, styles-0.1.min.css would redirect to styles.css of t...

Setting up cakePHP on shared host and remove /app/ in URL

Hello, I've installed cakePHP on a shared server where I can't set the Apache webroot, so it's currently pointing to /public_html. In that folder I have /cake, /app, /vendors, etc. Everything works fine; the only problem is that rather than links to controllers/actions being www.mysite.com/controller/action, there is an addition /app/ i...

Mod_Rewrite Trailing Slash Issue Problem/Question

Hello. I am trying to lock a client out of a PHP application I created them but, still allow them a "virtual" access to the doc root using: RewriteCond %{DOCUMENT_ROOT}/ftp/%{REQUEST_URI} -f [OR] RewriteCond %{DOCUMENT_ROOT}/ftp/%{REQUEST_URI} -d RewriteRule ^(.+) /ftp/$1 [L] This works like a charm when a user goes to: http://domain...

mod_rewrite empty REQUEST_FILENAME

I have this in my .htaccess file: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteRule !\.(gif|jpg|png|css|js|ico|flv|php|txt)$ index.php Now i need to add another rule that will forward to index.html if no REQUEST_FILENAME is found. So www.mysite.com would forward to index.html and www.mysite.com/file.html would forwar...

Apache mod_rewrite to merge two domains to one SSL connection

Hi there, I've got a client who recently changed their name. They had an SSL certificate for their site, and I was using mod_rewrite to ensure all requests to domain1.com and www.domain1.com went to https://domain1.com. Now that they are domain2.com, I'd like everything to go to https://domain2.com. Not so easy, it turns out. I have eve...

wordpress .htaccess with permalinks

I have a permalink working but as soon as I create a post it tells me that soory post not found permalink setting is to "/%pagename%/" and here is .htaccess: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /ryan/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d R...

How to rewrite if exists a php file with the same name?

Hello, I was searching in Google this question very much time but I don't find any answer. I want to rewrite http_//mydomain.com/f to http_//mydomain.com/ This is my .htaccess code: Rewriterule ^f$ / [R=301,L] rewrite works, but if exists a file called f.php, then doesn't work I tried to do this: RewriteCond %{REQUEST_FILENAME} !-...

Simple .htaccess rewrite ?

Hi guys. I forgot how to do that and I am stuck. I have a site say www.example.com and another folder www.example.com/docs/ I want when some one visits the www.example.com/ he will be redirected secretly to www.example.com/docs/ but still see in the URL www.example.com And even if the user types www.example.com/docs/ I want him to see w...

RewriteRule results in infinite redirection loop

The title doesn't give justice to the question. I have a site and I want it to be redirected to a subfolder. I have this right now: RewriteEngine on RewriteCond %{HTTP_HOST} ^mysite.net$ [OR] RewriteCond %{HTTP_HOST} ^www.mysite.net$ RewriteRule ^(.*)$ "http\:\/\/www\.mysite\.net\/subfolder$1" [R=301,L] The problem is that it result...