Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am working on a Wordpress project. I created a page just like author.php and need to pass parameters to it and want the address to look like the authors url (http:// somesite.com/author/thisguy) - let us assume my new page is xyz.php and I am passing http://somesite.com/xyz/thisguy

I read somewhere that I couldn't use the wp_rewrite because it is used only with index.php and my page is xyz.php

Therefore I'm trying to do this with .htaccess file.

I need to interpret (alias / RedirectMatch) this: http:// somesite.com/xyz/thisguy as http://somesite.com/xyz.php?myname=thisguy

Currently my .htaccess file looks like this: (Note that it has a rewrite mention for the membership plugin S2Member but I don't think it matters)

# BEGIN s2Member GZIP exclusions
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{QUERY_STRING} (^|\?|&)s2member_file_download\=.+
    RewriteRule .* - [E=no-gzip:1]
</IfModule>
# END s2Member GZIP exclusions

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

I tried:

RewriteRule   ^xyz/(.*)$ xyz.php?myname=$1

but didn't work.

Your help is greatly appreciated.

share|improve this question
Belongs to Stack Overflow, but in its current form not enough for a regular migration. – toscho Jul 11 '12 at 15:26

closed as off topic by anu, toscho Jul 11 '12 at 15:25

Questions on WordPress Answers are expected to relate to WordPress within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

try this:

RewriteEngine On
RewriteRule ^xyz/(.*)$ xyz.php?user=$1
share|improve this answer
thanks for you info. I edited the question because for some reason it was closed. I tried your suggestion but couldn't get it to work. – Joe Jul 11 '12 at 17:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.