mod_rewrite is a URL rewriting module for the Apache web server. It is commonly used for so-called "pretty" URLs because of its ability to redirect on the server side (transparent to clients and their browsers), but also provides the power and flexibility to perform various request handling tasks ...

learn more… | top users | synonyms

1
vote
1answer
89 views

Mod Rewrite - url rewriting

I am very new to mod rewrite. I need to redirect any user with "citzenhawk" parameter in their url to my url for example ...
1
vote
2answers
1k views

Re-indexing website with clean URL's

So I have a website with URL's like this: http://www.domain.com/profile.php?id=151 I've now cleaned them up with mod_rewrite into this: http://www.domain.com/profile/firstname-lastname/151 I've ...
1
vote
3answers
253 views

Including title page name in PHP URLs

How do I show titles of the page in URLs? Currently: http://websitename.com/index.php?c_id=18&start=0&m_id=1 Change To: ...
1
vote
2answers
114 views

Beginner's Apache mod_rewrite - use custom file for website root

Plain and simple - I want user to get main.php file instead of index.php, when he enters website. Such a straightforward task has caused me a lot of pain, and couple of hours googling. Following does ...
1
vote
2answers
194 views

Google Analytics when 404 handler is used as 'mod_rewrite'?

I'm consulting on a web site which in order to provide clean URL's uses the 404 handler to catch what would otherwise be a 404 and serve the correct content. In case that's not clear the 404 handler ...
1
vote
1answer
341 views

Apache rewrite returns error 500

I'm trying to figure out what I'm doing wrong with this .htaccess rewrite: Options -Indexes RewriteEngine on RewriteBase /test/site/ RewriteOptions MaxRedirects=10 RewriteCond ...
1
vote
1answer
236 views

Kohana with cherokee

How to setup kohana's index.php with cherokee webserver? Should i add a rule to redirect all to index.php? These settings don't work Rule RegExp ^.*index.php.*$ Redirect ^(.*)$ => index.php$1
1
vote
1answer
74 views

wrestling with some rewrites for Apache

I have upgraded my gallery2 to gallery3, and notice that some links no longer resolve correctly. Since the proper way is to redirect these with a 301, that is the way I'm going. The following series ...
0
votes
1answer
186 views

just another mod_rewrite question

from the url xxx.yyy.site.com just need to redirect to xxx.site.com Thanks for the help, sorry I have no regex/rewrite foo.
0
votes
1answer
678 views

Rewrite URL to a PHP script with parameters

I'm trying to create a service that you give it a URL like http://myhost.com/34.png and it will return the result of the script http://myhost.com/create_image.php?count=34. I know this is possible ...
0
votes
1answer
493 views

Using mod_rewrite to rewrite URLs with question marks in them

This is probably a mind-numbingly simple question, but for some reason mod_rewrite always manages to completely befuddle me every time I interact with it. A long time ago when I set up my blog and ...
0
votes
1answer
185 views

htaccess 301 Redirect with URI

How can I write a .htaccess mod_rewrite rule to redirect all traffic to a specific subfolder to a different subdomain, but include all the trailing URI and url structure and in a SEO friendly way. ...
0
votes
2answers
202 views

Pretending a file is in subdirectory with .htaccess

I have a web application, and it has a RESTful PHP backend that uses Zend framework (which does its own URL rewriting magic). The problem is, my backend's entry-page is api.php and the endpoints look ...
0
votes
2answers
531 views

SEO on multilanguage website URL

I'm setting up a multilanguage website and I would like to have your help to take the best decision as regard SEO. After reading this. I would like to change my URLs from this form ...
0
votes
1answer
944 views

Link to pages on site without .html extension appearing in browser?

I've modified my .htaccess file to allow access to html files without having to include the extension on the end, for example: www.mysite.com/document directs to www.mysite.com/document.html ...
0
votes
2answers
1k views

.htaccess rule not working without HTTP redirect [R]

I am using the following .htaccess with Wordpress to remove index.php from the visible URL. This works but forces an http redirect so the URL changes in the browser window. If I remove the [R] it no ...
0
votes
1answer
222 views

How can I point a subdomain at another server? [duplicate]

Possible Duplicate: How to point a domain to another subdomain? Is it possible to set up a subdomain to render content of another server? Let's say I wanted google.domain.com to render ...
0
votes
1answer
133 views

Switch to https

I'm looking to use an .htaccess file to use mod_rewrite to switch the protocol from http:// to https:// when someone hits my website. For instance, once someone goes to: http://www.mywebsite.com/ ...
0
votes
1answer
361 views

How to use apache mod-rewrite to remove trailing semi-colon on cookie?

We have the following cookie set by a product: Set-Cookie: SSOCookie=T7ngsCmzC2FEq5p2a7o%3D; path=/; domain=.demo.com; We would like to use Apache to remove the trailing ; which doesn't match the ...
0
votes
2answers
580 views

.htaccess rules to rewrite URLs to front end page?

I am adding a new application to my site at example.com/app. I want views at that URL to always open myapp.php. E.g. example.com/app -> example.com/app/myapp.php and example.com/app/ -> ...
0
votes
2answers
84 views

RewriteRules targeting a directory result in a gratuitous redirect

I have a standard CMS-like RewriteRule set up in my .htaccess: RewriteRule ^(.+)$ index.php?slug=$1 Let's say I have a directory called "foo" in the root directory. For some reason, if you hit the ...
0
votes
1answer
381 views

Force www. on multi domain site and retain http or https

I am using CakePHP which already contains an .htaccess file that looks like: <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) ...
0
votes
1answer
104 views

URL rewrite to another folder and file for specific requests

I have following directory structure on my local LAMP: www basic app router.php public index.html .htaccess and I can access my index page with localhost/basic/public/ and I am not using ...
0
votes
2answers
72 views

The number of soft 404 errors is increasing because of redirects to the home page

I have an increase in soft 404 errors. Using Apache in my .htaccess file I have: Redirect 301 /test.html‎ /page/pop/test Redirect 301 /about.html‎ /about I have also tried: Redirect 301 ...
0
votes
1answer
199 views

Using Apache's rewrite module to set up local host names for development

I have several websites on my development machine under Apache's htdocs folder. Apache Directory root is htdocs, but I want to be able to access each different site there by individual domain names. ...
0
votes
2answers
144 views

Redirecting non existing post to homepage; is that good for SEO? [duplicate]

I am checking my website out on Google Webmasters and I am seeing an astonishing 5000 links that could not be found by Google's Crawlers. That's normal, because my website is built in a manner that ...
0
votes
2answers
162 views

To Fix HTTP 400-499 error codes with 301 redirects in .htaccess file

This issue is on Wordpress site. I am aware we can change the URL naming convention in WP but i have changed my url format from date format to simple postname followed by slug as shown below. old ...
0
votes
1answer
99 views

Capitals in URL subdirectory not changed by htaccess

Within my WordPress website I am redirecting sub directories to internal and external links. Now, when you place a CAPITAL letter in the sub dir it does not work anymore and the website does not show ...
0
votes
1answer
206 views

mod_rewrite and SEO friendliness

My website has an atypical structure and I'm not sure if this could create problems in the long run, specially for SEO positioning purposes. I have a unique, large PHP script, and I use the Apache ...
0
votes
2answers
459 views

Redirecting IP address to domain address

Google has indexed the IP address of my site rather than the domain, so now I'm trying to set up a 301 redirect that will redirect the IP address and all subsequent pages to the domain. I currently ...
0
votes
2answers
520 views

When using Mod_rewrite does google bot see the original url or the rewritten url?

If i use the bellow code in my .htacess file would google bot (or any other search spiders) see the example.tumblr.com url or would they see the same url as the user ie. example.co.uk/blog ? ...
0
votes
1answer
574 views

mod_rewrite problems - redirect subdomain to different domain

I must have a brain freeze as I can not get my rewrite rules working. RewriteEngine On RewriteCond %{HTTP_HOST} ^otherdomain\.example\.com [NC] RewriteRule ^(.*) http://www.otherdomain.com/ ...
0
votes
1answer
227 views

htaccess - “detect” url and redirect

Idea is: if URL = "http:/localhost/site/" else if URL = "http:/localhost/site" redirect to "http:/localhost/site/index.html" Can this be done with .htaccess / Apache mod_rewrite and how?
0
votes
1answer
382 views

short and friendly URL for affiliate links

This is my first question here on Pro Webmaster... I'm really glad to be here! I believe this question will have a simple answer but I'm starting with htaccess and I want to learn something about ...
0
votes
2answers
2k views

.htaccess rewrite www to non-www and remove .html

I need rewrite rules to redirect the following: http://www. to http:// /file.html to /file I've tried using a combination of these but each time it results in a redirect loop on one of the ...
0
votes
1answer
553 views

Verify 2 cookies with mod_rewrite before serving images

I have the following mod_rewrite rule, which works fine in my Apache 2.x on CentOS 6 Linux machine, but is not complete: RewriteCond %{HTTP_COOKIE} !id RewriteCond %{REQUEST_URI} ...
0
votes
1answer
756 views

Override .htaccess from parent directory

I have a local LAMP stack (without the MySQL. LAP stack? Anyways..) and I am using this as a development environment for a production website. The site is placed in a sub-directory of the Apache2 ...
0
votes
1answer
547 views

.htaccess 301 rewrite rule not working

I had made the page the-book.html in wordpress site, later changed the name to about-the-book, now i have written the .htaccess file as **RewriteRule ^the-book.html$ ...
0
votes
1answer
375 views

mod_rewrite prevent repeating backreference

I am trying to match a single reference in a URL to pass to a script, while retaining the rest as the path to the script. For example: #/scripts/paramater/foo/bar.php should call ...
0
votes
1answer
267 views

Redirect all urls to a subfolder

I have several old, broken urls that looked like this: http://www.easyjob.net/partners/whatever.html I would like to redirect them all to http://www.easyjob.net/partners/general/ The following rule ...
0
votes
2answers
90 views

How to make mod_rewrite work transparently?

Following is the content of .htaccess file <IfModule mod_rewrite.c> Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ...
0
votes
1answer
393 views

.htaccess mod_rewrite domain to subdomain

I need to redirect any domain to a sub-domain. I know this has got to be possible but for the life of me i can not figure it out. Any help is appreciated. For example: domain1.com domain2.com ...
0
votes
1answer
287 views

Changing mod_rewrite “file exists” checks to not see directories as files

I have the following mod_rewrite rules set up: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php This works fine, allowing me to ...
0
votes
1answer
212 views

Mod RewriteRule not working on all URL's

this is my .htaccess Options +FollowSymLinks RewriteRule ^(.*)wp-content/uploads/(.*) $1watermark.php?src=wp-content/uploads/$2 # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On ...
0
votes
2answers
860 views

Apache mod_rewrite rule to convert URL of page, keeping parameters same

I sent out a link in an email that had a typo in the URL. I need to make a quick change for tracking purposes so that any incoming hits to the URL are instead parsed to another URL. From the link ...
0
votes
1answer
258 views

How to block access to a sub-site with mod_rewrite?

Let's say I have the sites siteA.com and siteB.com. They are hosted such that siteB.com actually points to siteA.com/siteB. How can I block someone from visiting siteA.com/siteB using mod_rewrite? ...
0
votes
2answers
168 views

Help with Apache mod_rewrite rules

I want to change some legacy URL's like this: /modules.php?name=News&file=article&sid=600 to this: /news/story/600/ This is what I have tried: RewriteEngine on RewriteCond ...
0
votes
2answers
159 views

Is it possible to mod_rewrite BASED on the existence of a file/directory and uniqueID?

My site currently forces all non www. pages to use www. Ultimately, I am able to handle all unique subdomains and parse correctly but I am trying to achieve the following: (ideally with ...
0
votes
1answer
662 views

.htaccess: Redirect Hotlink Flash --> Site with embed Flash

I have some PHP sites that embeds SWF files. These SWF files are now linked to by some other guys. And I don't want them to simply open the SWF, I want them to force being redirect to the page where ...
0
votes
1answer
510 views

Apache mod_rewrite for multiple domains to SSL

I'm running a web service that will allow people to create their own "instances" of my application, running under their own domain. These people will create an A record to forward a subdomain of their ...