Changing the Display URL Using Mod Rewrite - wordpress

I need to change the display URL from
www.site.com/blog/events/
to
www.site.com/events/
I have installed WordPress in
/blog/ directory and have installed a plug-in for /events/ for dynamic event management.
Basically, I want to get rid of /blog in the URL when /events/ occurs in the URL.
I have tried various rewrite rules using .htaccess file but none of the rules worked out.
Also, there are 2 .htaccess files (the first .htaccess file is the default file found in the root path of the web server and the other is the default WordPress .htaccess file presents inside /blog/ directory).
I am little confused on which .htaccess file I need to try the URL mod rewrite rule.
How to do this using URL mod rewrite conditional rule?
Please help me to see the light. Any support would be greatly appreciated!
Thanks in advance...

Try this code in htaccess root directory :
RewriteEngine On
RewriteRule ^events/(.*)$ /blog/events/$1
The first line allows you to rewrite url. The second line check if the url begin with "events/", and if it's the case, the server is going to look files in the real "blog/events/" directorie.

Related

how to add timthumb rewrite after theme set up

here is my htaccess rewrite rule for my theme's timthumb script.
RewriteRule ^pics/([0-9]+)x([0-9]+)x([0-9]+)x([0-9]+)/(.*)$ wp-content/themes/mt_movie/crop.php?src=$5&h=$1&w=$2&q=$3&zc=$4 [L]
I found a text about rewrite rules, on wp codes docs pages.
But i don't know what should i do / or how can i use my RewriteRule via this functions.
Here is the doc link : http://codex.wordpress.org/Rewrite_API/add_rewrite_rule
Actually i want to add this rule after when my theme activated on my customer's web site?
Could anyone help me about this.
Thanks.
This is an Apache rewrite rule. It should go in the .htaccess file in the wordpress directory on your server, assuming that your web server is apache.

rewrite rule for files with pattern to go to subdirectory

I have files with this pattern :
(a[0-9]+\.htm)$
Considering file names a1180717200.htm or a1245862800.htm : normally they would be in root for the domain I am working with. Instead they have been moved to a new directory /archives so the files are now in :
thedomainiamworkingwith.com/archives/a1245862800.htm
I have tried a few things but I have no success. The root is occupied by a working wordpress site, with its normal .htaccess file set up. So I need to know what the redirect or RewriteRule would be, as well as how to put it in the .htaccess file without messing up the current wp install.
Are you trying to redirect your pages of this pattern to archives directory?
You can try something like this
RewriteRule ^(a[0-9]+.htm)$ thedomainiamworkingwith.com/archives/$1 [R=301,L]

URL rewriting For WordPress - Integrating Non Wordpress site with wordpress

We are unable to change the url rewriting to integrate an exsiting directory site into my wordpress site.
WordPress is fixing everything to their url pattern.
How can I help my programmer? Can someone give an advise?
More details would be useful, but in all likelihood, add a do nothing and stop rule for your folder before the WP rules:
RewriteEngine On
RewriteBase /
RewriteRule ^folder - [L]
We integrate WordPress with Ruby-on-Rails on ICanLocalize.
This is done in the Apache config file. Use the Apache Alias command to indicate that a path comes from a different physical directory.
Then, the URLs that match that path will never go to WordPress. They will be served from the other physical directory, where you can place anything.
If you need to take a subdirectory out of the url-rewriting from wordpress, put an additional .htaccess file into that directory and switch the Rewrite-Engine off:
RewriteEngine Off
That directive overrides any settings of the wordpress .htaccess for that directory and it's subdirectories.
You find the longer version of my answer in a related question on wordpress answers with a slightly different .htaccess code.

rewrite problem : put magento inside drupal installation directory

I have put magento inside a drupal installation in a subdirectory called store.
When I access http://localhost/myshop/store magento home page is showed without problem but when i try to access any link inside magento (example http://localhost/myshop/store/admin) i get a drupal page that tells me that the page is not found !
What should I do to make all request under /store path be dispatched to magento insted of drupal ?
edit your .htaccess rewrite path to be /myshop
############################################
## you can put here your magento root folder
## path relative to web root
#RewriteBase /magento/
look for this in .htaccess and uncomment RewriteBase and change /magento/ to your directory name
In the .htaccess file for Drupal - that is, /myshop/.htaccess - add the following before the line with RewriteRule in it.
RewriteCond %{REQUEST_URI} !^/store/
This excludes your Magento directory from Drupal's rewriting and so allow Magento to continue as normal. You shouldn't need to change Magento's /myshop/store/.htaccess file for this.

WordPress pages outside install directory

I have WordPress installed in a subdirectory and I'd like one WordPress page to appear as if it's on the root.
Eg.
/wordpress/mypage
To appear as:
/mypage
Assuming you're on Apache, and you've got permalinks already working, you can use an .htaccess file in your document root to rewrite yoursite.com/wordpress/mypage to yoursite.com/mypage.
If you don't already have a .htaccess file in your document root, create one and put this in:
RewriteEngine on
RewriteRule ^mypage$ wordpress/mypage
I'm no .htaccess expert, but that should do the trick.

Resources