XF 1.4 URL rewrites without redirecting

I'm in the process of setting up .htaccess RewriteRules for various parts of the site, both to redirect old vb4 URLs and also to preserve some custom parts of the site.

In VB, I was using a custom php file and rewriting to it for a more pleasing URL, e.g.

RewriteRule ^this-looks-nice-for-august-([0-9]+).html?$ mycustompage.php?date=08-$1 [NC,L]

Rather than make a custom PHP file in XenForo, I created an addon to add custom content to a page instead. I made a new RewriteRule like this:

RewriteRule ^this-looks-nice-for-august-([0-9]+).html pages/mycustompage/?date=08-$1 [L]

That doesn't work and results in a "Route this-looks-nice-for-august-2015.html/ could not be found." error. This, however, does work though it redirects to the URL whereas I'd prefer it to keep the more pleasing URL:

RewriteRule ^this-looks-nice-for-august-([0-9]+).html pages/mycustompage/?date=08-$1 [R=301,L]

Thanks for any insight!

- adamsmasher
tonymacx86.com
 
I did a bit more searching and found this article:

ErrorDocument (.htaccess)

I'm guessing it isn't working because XF's default .htaccess prevents any file from "not existing", basically. I added this to top of the default conditions and rules:

RewriteCond %{REQUEST_URI} ^/this-looks-nice-for--([A-Za-z-]+)-([0-9]+)\.html [OR]

It now just throws a 404 error, though still no rewrite. :P

-adamsmasher
tonymacx86.com
 
You're really fighting against the system with what you're trying to do. You'd probably do better trying to do some custom development in the router to handle the redirect, though I'm not sure exactly what that'd look like off hand.
 
You're really fighting against the system with what you're trying to do. You'd probably do better trying to do some custom development in the router to handle the redirect, though I'm not sure exactly what that'd look like off hand.

Thanks, Mike! I had a feeling I was going about this ass-backwards. I'm stll getting my feet wet with XF.
 
Top Bottom