I started a blog and when I changed my permalink structure to /%postname%/ I get a Page Not Found error. I want my url to look like this:
http://bobbybeckner.com/sharepoint-list-and-linq-using-jquery-and-ihttphandler/
not this:
http://bobbybeckner.com/index.php/sharepoint-list-and-linq-using-jquery-and-ihttphandler/
I read a few posts about changing .htaccess but found no clear solution. Any code examples welcome or recommendations on wordpress plug-ins would be greatly appreciated.
Update
I thought it would be important to mention that my host is running IIS7 but does not allow users to touch it. In addition, I'm uncertain of any restrictions on the .htaccess file or any other configuration limitations.
.htaccess files only apply to Apache (well, maybe some other servers use it too, but not IIS). AFAIK URL rewriting for IIS is possible, but not as easy.
ISAPIRewrite appears to be a commercial application that does this, but of course, you'd need to get it installed on your server.
Personally, I wouldn't lose any sleep over having /index.php/ in your urls.
Generally when you fill out the structure, if the .htaccess file is writable it will apply the rewrite for you, and if it isn't it will show what the contents should be at the very bottom of the page. Did you check the bottom of the page if it is not writable?
You do NOT have to code this yourself.
Related
I have setup a Symphony framework on my localhost using this tutorial. I am using the PHP default server and MySQL.
The frontend URL is working fine but when I go to the admin URL (http://localhost:8000/symdemo/admin), then my CSS URL is also redirected to the admin page meaning I am not getting CSS code into the response.
The reason as that the default PHP server does not have a URL-rewriting module and index.php is also adding to the CSS path.
How can I fix this?
I'm not 100% sure, but I think you'll find that using a webserver that supports rewrites is quicker than trying to replicate the necessary rewrites in PHP. Rewrites are listed as a requirement in Symphony CMS's readme, and last time I checked Symphony was still dependent on webserver rewrites for some of its routing/files.
You can, of course, use Apache. If you'd like to use a lighter and cleaner webserver that's easy to configure, I recommend Hiawatha, which has a Symphony URL toolkit/rewrite rule set available.
I have a site with this structure:
Home
About Us
Products
Product
Services
Contact
If I open
mysite.com/products
reads page-products.php
and
mysite.com/product
reads page-product.php
I need to use page-product.php as a generic page.
For Example...
mysite.com/product/The-Best-Product/32
read page-product.php?name=The-Best-Product&id=32)
And how about
mysite.com/john/
and reads page-user.php?username=john
Its possible to make something like that works?
Thanks!
Consider using the Apache Web server's mod_rewrite, which is a very powerful tool to do just what you need. This would only help you if you are using Apache. Also, if you are not the Webmaster, mod_rewrite must have been enabled for use in .htaccess files.
The bottom of the page I linked has some examples on how to use this. Also, there are many tutorials around.
I'm literally just starting to throw a site together today, so I don't even have much to work with yet, but I wanted to throw this out there so I'll have the information when I get there. I'm using WAMP (not sure which version, but downloaded within the last 6 months) and CodeIgniter 2.0.3. How do you manipulate the URL to do the following:
www.mysite.com/forums ==> forums.mysite.com
www.mysite.com/pc ==> pc.mysite.com
...
Would this be something that gets done with the htaccess file or some other way? And if it is the htaccess file, can someone provide specifics? I've looked into some sites that try to explain the htaccess file and they just confuse the crap out of me. :) lol. Oh yeah, and how will that look while looking at it on my local host? Currently my url looks like:
localhost/nothingbutcards/
Thank you all very much, hope you're enjoying your weekend.
Along with the reference material provided, the below should be a good starting point. It's an HTACCESS approach.
http://terriswallow.com/weblog/2008/htaccess-redirect-a-directory-to-a-subdomain-and-force-www/
I also wanted to mention, some web hosts now have this as an option in the configuration panel. Mine does, so I can go in, specify a subdomain and the path on the site it points to, and I'm done.
Say if you visit my site: http://nesmods.com/page/2/ there isn't actually a /page/2/ on my site, Wordpress somehow catches the URL and generates a page based on the URL. What is the name of this technique?
This redirecting is managed by the mod_rewrite Module of Apache. Normally this is done in the .htaccess file. Depending on the configuration of your FTP program you can see them as hidden files in the Wordpress root directory.
Some further explanations and examples: http://www.workingwith.me.uk/articles/scripting/mod_rewrite - and Google of course.
Clean URLs apparently. Often done through .htaccess files.
There are a few ways to do this, referred to as URL routing or URL rewriting. Wordpress uses URL routing to map URL structures to it's internal functions that generate content.
It can also be done with the web server itself, such as URL Rewriting with Apache mod_rewrite
Apache hava a module of rewrite url。
It is a good search engine optimization。
This is a detail info about rewrite http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
I'm trying to make local development copies for my wordpress blog. I tried first to install wordpress locally (on XAMPP for Windows), install the plugins then import the live data (from a DB backup). The problem is whenever I import the live data I start getting all sorts of errors, even after I change the blog's URL through the database.
Also, the redirection rules I have on my server don't seem to work locally (whether set by wordpress or some of its plugins).
So is there a safe way to just grab the whole thing and make it work locally exactly like the server?
Your help is much appreciated :)
get a full backup of all the files in your online wordpress installation
get a complete backup of the database in use
with any text editing software, process the SQL file of the database backup and change every occurrence of http://old.site with http://localhost
extract the files to your document root
edit wp-config.php to tweak database host/user/pass
import the modified SQL backup
login into admin panel, go to Options->Permalink and save to update permalinks
No need to install anything, just grab what you have online. On windows you might have to rename .htaccess
Maybe somebody will come up with a tool, tutorial or a full HOWTO on this, but in the meantime a few general things on migration:
The redirection rules probably don't work because Windows has trouble with the .htaccess file name due to the starting .. What I usually do is, add (or change) the AccessFileName directive in my Apache config to htaccess.txt that makes the file better usable on Windows. If that doesn't help, put the contents of .htaccess up here.
From my (albeit limited) Experience with Wordpress, it is better to make a raw copy of the Wordpress file and data structure, rather than installing a fresh version and adding all the plugins. There is so much change in the Wordpress code base (automatic update of plugins etc.) that problems are legion. You would then have to change the paths locally in the configuration files, or set up a local path structure that exactly imitates that on the server.
Can you post some of the errors you get when using the live data?
Perhaps a much simpler way would just be to add a host reference from the address of blog to local host e.g. http://en.wikipedia.org/wiki/Hosts_file. This would allow you to test your blog as if it were actually running on the domain without any of the potential pitfalls.
Here is my 2cents tip:
If you are using plugins, and one of them has an api-key (for an example, Google's analytical toolkit, requires a key), the key may be bound to the IP address where your wordpress blog is located and may fail under the localhost (127.0.0.1). So double check to see if you can obtain a global key which can work on any IP address. This is dependent on the service and plugin. Google Maps is one, Recaptcha is another that comes to mind.
Hope this helps,
Best regards,
Tom.
kemp's answer is just about perfect. I only wanted to add that you could download something like VirtualBox or VMware and install Linux to it and get a webserver up and running on the virtual machine. This would let you get past any WAMP-LAMP inconsistencies.
Kemp's answer is good - but you don't need to edit your SQL dump, or change the database.
Instead, add 2 lines to your wp-config.php file (I normally add them just above the comment line in the file:
define('WP_HOME','http://localhost');
define('WP_SITEURL','http://localhost');
/* That's all, stop editing! Happy blogging. */ <-- this line already present in the file.