Community Forums › Forums › Archived Forums › Design Tips and Tricks › rewriting the URL so as to not use ?foo=bar
- This topic has 4 replies, 2 voices, and was last updated 11 years, 4 months ago by
abs.
-
AuthorPosts
-
April 9, 2015 at 4:47 am #147190
abs
MemberHi Everyone
I'm Andrew and live in Sydney, NSW, Australia. New here, I'm okay with doing WordPress stuff, but have been doing web stuff for some time, pretty much self taught.Am revamping my wife's business website and am using WP & Genesis but now getting to some of the grittier pages where in the past I would do http://www.example.com/blah.php?foo=bar or using a Rewrite Rule do http://www.example.com/blah-bar (changing blah-* to blah.php?foo=* )
So, I'm now wanting to do this in WordPress. If I code blah.php?foo=bar, I get the $_REQUEST["foo"] has a value of bar, but where in WordPress can I set up the appropriate rewrite rules (or equivalent). Using the .htaccess doesnt seem to work, and I'm going around in circles searching online for answers.
Hoping someone can point me in a properling documented answer 🙂
Cheers
PS I thought I created a new thread earlier, but might not have done something properly... I apologise in advance if the original is their somewhere
April 9, 2015 at 6:17 am #147196Brad Dalton
ParticipantHi
What URL exactly do you want to rewrite and to what?
Try this http://www.smashingmagazine.com/2011/11/02/introduction-to-url-rewriting/
Also, this question is not really specific to StudioPress child themes. All questions are welcome here however you might find the .htaccess tag on Stackoverflow.com a better place to ask this type of question.
April 9, 2015 at 6:23 am #147198Brad Dalton
ParticipantApril 9, 2015 at 7:08 am #147203abs
Memberthanks for your replies Brad... just to clarify
change
website/blah-bar
to become
website/blah.php?foo=bar
Thus whatever comes after the blah- is passed in on the foo variable 🙂 but the URL is coded as website/blah-bar
Off to check those links
April 9, 2015 at 5:44 pm #147261abs
MemberIf anyone can help, this is really strange
PS Brad, I already knew how to write rules but did glean some extra info from the links - thanks, this seems more specific to using rules in WordPress
So, my .htaccess currently reads :
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^aaaa$ /index.php [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule># END WordPress
with the line after the RewriteBase added by me to test. I would expect that if I go to website/aaaa to be taken back to my home page. But I just get page not found
It's almost as if the rules arent being looked at at all (even if I take out the IfModule statements too
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.