2

I am trying to rewrite a specific PHP file GET parameter but cant seem to get things to work.

I want to rewrite http://www.example.com/meeting.php?ref=y0fpjXrrGP so it is http://www.example.com/meeting/y0fpjXrrGP

What am I mising on the below? Note I am using WordPress so adding to the existing htaccess file.

# 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]
RewriteRule ^meeting/(.*)$ meeting.php?ref=$1
</IfModule>

# END WordPress

Options -Indexes

Adding RewriteRule ^meeting/(.*)$ meeting.php?ref=$1 does not seem to work at all.

1
  • It wiil not because every non file name request is being rewriting to index.php i suggest you to go wordpress way for rewriting and add tag of wordpress in your question to get more help. Commented Dec 7, 2016 at 15:52

2 Answers 2

2

Just use this in your .htaccess file:

RewriteEngine On
RewriteRule ^meeting/([^/]*)$ /meeting.php?ref=$1 [L]

It will leave you with the URL: http://www.example.com/meeting/y0fpjXrrGP

Make sure you clear your cache when testing this.

Sign up to request clarification or add additional context in comments.

Comments

0

You don't need to add that to .htaccess, if your URL is inside your Wordpress, you need to add them to the rewrite URL

Check this: How to create custom URL routes?

Hope it helps.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.