| 11:26 am on Feb 17, 2010 (gmt 0)|
First to admit my .htaccess is pretty lightweight, but it seems that .htaccess on a development machine is not going to work the same way... there is no outside access... and if there is... why? (Defeats of the purpose of development systems!)
| 11:38 am on Feb 17, 2010 (gmt 0)|
I want to replicate the sites functionality as closely as possible on the development/test site, in order to spot any mistakes before making it live.
| 12:25 pm on Feb 17, 2010 (gmt 0)|
[edited by: g1smd at 12:31 pm (utc) on Feb 17, 2010]
| 12:30 pm on Feb 17, 2010 (gmt 0)|
I add an optional "dev." after the "www." in the domain canonicalisation rules.
I edit the HOSTS file on my PC to make www.dev.domain.com resolve to the test server's IP.
The Apache Config on the dev server is setup to handle (www.)dev.domaon.com requests.
I now have two sites, dev and www, hosted in different places, but dev is not 'world accessible'.
| 1:33 pm on Feb 17, 2010 (gmt 0)|
I must be dense as a post. How is that going to work? Dev machines do NOT talk to the world (or shouldn't) and any .htaccess has nothing to work with.
And if it does work with the world what are the implications with B, G, and Y? Seems to me //local is just that. Serious question. Follow up: I tried that xxamp setup and it worked... then worked me on the backend correcting links, etc. Easier for this old fart to just do it in Homesite and post it correct the first time around...
| 1:57 pm on Feb 17, 2010 (gmt 0)|
The order of the first and second rule need to be reversed. Otherwise, a request for a no-trailing-slash URL-path from the non-www domain will invoke two back-to-back redirects.
With an eye toward efficiency, the function of the RewriteCond in your currently-second rule could be "rolled into" the RewriteRule, simply by removing the leading slash from the pattern and -keeping the surrounding parentheses- using it to replace the RewriteRule's pattern.
The Hosts file set-up g1smd described is for local development where the dev server is not to be world-accessible. If the localhost is accessed locally via HTTP, then Apache and .htaccess will be invoked as it would be on a 'public' server. If your dev server is to be publicly-accessible (in the sense of at least *some* people/agents being able to work on it), then you would define the "dev" subdomain in your usual DNS zone file, rather than in the local machine's Hosts file.
| 2:12 pm on Feb 17, 2010 (gmt 0)|
Jim, three paragraphs reminds us why you are ghod in these things. Did the eye blinky-blink thing several times and included the smack in the forehead. Thank you--and to g1smd too, for revealations xamp local. Thanks.
Meanwhile I'll do it the other way, avoiding errors in the first place and having no need for redirects. I like KISS best. Sometimes thought is better than fast...
| 3:39 pm on Feb 18, 2010 (gmt 0)|
Thanks everyone for your help, its appreciated :)
| 10:31 am on Feb 21, 2010 (gmt 0)|
ok if ur running under window with apache configuration , do as following:
I record the steps here so that it can help those who want to enable .htaccess and url rewriting in Apache for Windows and also for my own reference in future.
1. Make sure you have setup apache and php correctly. Make sure that you can run php scripts without any problem.
2. Use notepad to open httpd.conf config file. Make use the line "LoadModule rewrite_module modules/mod_rewrite.so" is un-commented.
3. Under "<directory #*$!></directory>" section, change the line "AllowOverride None" to "AllowOverride All".
4. Change the line "AccessFileName .htaccess" to "AccessFileName htaccess". This is because in Windows, we can't have a file with filename that starts with a dot.
5. Save the changed file and restart Apache Windows Service. You can then use the file htaccess to process your url rewritting.
Hope this will help u
- Rajendra Pondel
| 3:45 pm on Feb 22, 2010 (gmt 0)|
@Rajendra -- This is because in Windows, we can't have a file with filename that starts with a dot. --
Only if you try to create/rename/save-as a file as .htaccess via Windows itself.
I use Eclipse as IDE, and I could create .anything
| 2:47 am on Feb 25, 2010 (gmt 0)|
@blend27, yeah you are right that we just can't rename, name a file with dot. You are also right that we can just copy the file and save it, but Apache comes with the power of naming the file which we can use as .htaccess, so why don't just use that power?
This configuration works best in my development pc, and that's what I wanted to be done.
- Rajenra Pondel
[edited by: jdMorgan at 4:04 am (utc) on Feb 25, 2010]
[edit reason] Edited 'Leet' spelling for all of our international readers. [/edit]