NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > General Marketplace > Web Development > Web Development Wanted
Reload this Page WordPress / mod_rewrite expert needed

Web Development Wanted Requests for websites, templates, custom programming, logos or graphics.

Advanced Search
1 members in live chat ~  
NamePros Design Contests NamePros Design Contests
Forum Sponsorship
Join in on the FUN! You can start an affordable design contest and pick from entries talented members submit or you can enter a design contest for a chance to win CASH PRIZES! What are you waiting for? Get started in the fun TODAY! - Banners, Logos, Mascots, and MORE! (Please READ the design Contest section rules Prior to starting or entering a contest)



Closed Thread
 
LinkBack Thread Tools
Old 11-30-2011, 02:06 AM THREAD STARTER               #1 (permalink)
First Time Poster!
Join Date: Nov 2011
Posts: 1
meeble is an unknown quantity at this point
 



Help! WordPress / mod_rewrite expert needed


Hello,

I am trying to use mod_rewrite and modify WordPress' URL handling to allow for passing variables to PHP from the URL while maintaining "pretty permalink" functionality. (on WP 3.2.1)

Something like this:

http://epiclasers.com/hello-world
(normal with permalinks set to /%postname%)

http://epiclasers.com/state/hello-world
(WP should display the same hello-world post as above, but also would pass the state string to PHP as a variable)

http://epiclasers.com/state/city/hello-world
(WP should display the hello-world post, but would pass the state and city strings to PHP as variables)

I added the following mod_rewrite code to my .htaccess file:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(\w+)/(\w+)/ /index.php?st=$1&city=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
????: NamePros.com http://www.namepros.com/web-development-wanted/739068-wordpress-mod_rewrite-expert-needed.html
RewriteRule ^(\w+)/ /index.php?st=$1 [L]

which kind of works. The variables are being passed, and PHP can grab them with:
$state = $_GET['st'];
$city = $_GET['city'];

The problem is that WP is getting confused by the URL and isn't finding the post. URL's like these:

http://epiclasers.com/state/city/hello-world
http://epiclasers.com/state/

are bringing up a page not found error. Also, when entering this URL:

http://epiclasers.com/state/hello-world

It redirects to: http://epiclasers.com/hello-world
which then displays the post fine.

How do I modify the WP URL handling code to ignore the /state and /city parts of the URL without also breaking URLs like:

http://epiclasers.com/category/category1
http://epiclasers.com/tag/tag1
http://epiclasers.com/category/category2/subcategory

etc.

Thanks,
Devin
Last edited by meeble; 12-02-2011 at 10:51 AM.
meeble is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Free Wordpress Themes and Free Joomla Templates Elegant_Designs For Sale / Advertising Board 2 11-09-2011 05:27 AM
Wanted: WordPress Expert Nathan Web Development Wanted 2 08-29-2011 03:47 AM
Wordpress Expert darell1986 Developers For Hire 0 08-24-2011 05:53 PM
Need Wordpress expert helps ucok Website Development 3 08-23-2011 05:49 AM
Required: Wordpress Integration Expert = Good Money Premium Web Development Wanted 7 07-28-2011 10:55 PM

 
All times are GMT -7. The time now is 11:23 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger