Skip to main content
added 492 characters in body
Source Link

I am migrating from an ancient static web site to Wordpress.

In the old site, I used htaccess and RewriteRule to simplify URLs and mask the underlying parms. One case was:

RewriteRule ^definition/([^/]+) /display-definition?word=$1 [NC]

This allowed people to specify a URL of:

domain.com/definition/love

And under the sheets executed instead:

domain.com/display-definition?word=love

I have created and tested the new Wordpress page, and manually passing it the parameter works fine. The htaccess redirect does not, and instead tosses visitors to the default Wordpress 404 page.

I have tried placing the RewriteRule in various places in htaccess, but the results do not differ.

Current attempted htaccess file is:

RewriteEngine on
RewriteRule ^definition/([^/]+) /display-definition?word=$1 [NC]
RewriteRule ^murphyism/([^/]+) /display-murphy?id=$1 [NC]

# 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 am migrating from an ancient static web site to Wordpress.

In the old site, I used htaccess and RewriteRule to simplify URLs and mask the underlying parms. One case was:

RewriteRule ^definition/([^/]+) /display-definition?word=$1 [NC]

This allowed people to specify a URL of:

domain.com/definition/love

And under the sheets executed instead:

domain.com/display-definition?word=love

I have created and tested the new Wordpress page, and manually passing it the parameter works fine. The htaccess redirect does not, and instead tosses visitors to the default Wordpress 404 page.

I have tried placing the RewriteRule in various places in htaccess, but the results do not differ.

I am migrating from an ancient static web site to Wordpress.

In the old site, I used htaccess and RewriteRule to simplify URLs and mask the underlying parms. One case was:

RewriteRule ^definition/([^/]+) /display-definition?word=$1 [NC]

This allowed people to specify a URL of:

domain.com/definition/love

And under the sheets executed instead:

domain.com/display-definition?word=love

I have created and tested the new Wordpress page, and manually passing it the parameter works fine. The htaccess redirect does not, and instead tosses visitors to the default Wordpress 404 page.

I have tried placing the RewriteRule in various places in htaccess, but the results do not differ.

Current attempted htaccess file is:

RewriteEngine on
RewriteRule ^definition/([^/]+) /display-definition?word=$1 [NC]
RewriteRule ^murphyism/([^/]+) /display-murphy?id=$1 [NC]

# 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
Source Link

htaccess redirects and Wordpress

I am migrating from an ancient static web site to Wordpress.

In the old site, I used htaccess and RewriteRule to simplify URLs and mask the underlying parms. One case was:

RewriteRule ^definition/([^/]+) /display-definition?word=$1 [NC]

This allowed people to specify a URL of:

domain.com/definition/love

And under the sheets executed instead:

domain.com/display-definition?word=love

I have created and tested the new Wordpress page, and manually passing it the parameter works fine. The htaccess redirect does not, and instead tosses visitors to the default Wordpress 404 page.

I have tried placing the RewriteRule in various places in htaccess, but the results do not differ.