Right now I have a few sites that use ASP.NET MVC and while I do enjoy the routing structure I hate a lot of Windows Server works (and also how it sometimes doesn't work for no reason). I've had enough of running two servers, one with Windows and one with Apache and I'm jumping ship to go strictly PHP. I'm abandoning my CMS and going to use Wordpress and let someone else handle the backend.
Right now I have the URL structure as "domain/(controller)/(action)" layout. Your basic MVC structure.
I have it set so that "domain/Page/(pageTitle)" displays the pages and "domain/Article/(articleTitle)" (Page and Article are literals that target the controllers as part of the URL while the items in parentheses are variables). The way wordpress works is simply "domain/(pageOrArticleTitle)" but since I've been ranking #1 on google for my hometown I don't really want to mess that up and have google have 404s. Can I have the pages and articles forward using the .htaccess file and send a 301 for the original URL structures and forward to the new URL so that google doesn't drop me in the results?
Any idea how to handle this? Any advice is very welcome.
Why PHP? If you were to go with something more modern, say, Python using flask, you can have routing too: http://flask.pocoo.org/docs/quickstart/#routing
Pennsyltucky? Isn't that WV?
In answer to your question, mod_rewrite is VERY powerful because it uses a regex engine to capture information and use it to redirect. However, nowhere in your post did I see that you were retaining the same data in your links in your new structure to allow capturing variables and using them to redirect.
You might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It's helped may members and should help you, too.
That said, you have two options: Redesign your new site's links to retain some/all of the link information from the old website OR use a RewriteMap (probably use a "handler file" for the redirect) to redirect EACH of the old pages to their corresponding pages in the new website (with permanent redirections so you don't have to go through this painful experience again).
"Speficity!" There, I said it again. More information about your links (that they can be used in redirections) or not; how many redirections (pages) are being moved; etc., the better the answer you'll get.
The Apache documentation considers this a scenario where you should not use mod_rewrite.
[Redirect and [URL="http://httpd.apache.org/docs/current/mod/mod_alias.html#redirectmatch"]RedirectMatch](http://httpd.apache.org/docs/current/mod/mod_alias.html#redirect) were designed for scenarios exactly like this one.
Thank you for the information. It looks like using "RedirectPermanent URL-path URL" is what I'm looking for. Seems simple enough.
This topic is now closed. New replies are no longer allowed.