Please advise me regarding rewrite rules

Discussion in 'Forum SEO' started by ChrisTERiS, Sep 4, 2017.

  1. ChrisTERiS

    ChrisTERiS Developer

    552
    142
    +306
    Have to admit it. Never understood in depth how rewrite rules work. I mean which is the best structure, if they work for all servers without changes etc. So I'll appreciate your advice and hope that you'll not start laughing with my novice questions :)
    1. Ok, I know that rewrite rules are to be include in a .htaccess file working fine with Apache servers. But what's next. There are also windows servers running under ILS. Does the same rewrite rules will work with window servers?
    2. If all servers support rewrite rules even with some minor changes, does it has any meaning to have in my code support for old style urls (eg thread.php?do=view&threadid=1) or is better to use friendly urls only?
    3. What is the best structure? And make the question simplier. What is better:
      1. thread/1/my-thread-title.html
      2. thread/1/my-thread-title
      3. thread/1/my-thread-title/
      4. thread/my-thread-title/1/ even if I'm not sure that this structure is possible.
    4. And last, the most novice question :) ... Does it has sense (but I mean for search engines) to have friendly urls for protected areas (eg usercp)?
    Thank you in advance
    Chris
     
  2. ColinD

    ColinD Enthusiast

    106
    93
    +51
    Chris,

    Not all web servers support the ./htaccess syntax. Nginx, for example, won't. But you can usually figure out the new syntax. Some will as a feature, for example, litespeed; enterprise $$, is Apache compliant, so easy to replace. Unless you have a real need like a .net/c# app, I'd avoid windows servers, purely on additional cost.

    Rules, I'd say unless you have to, don't use them. It used to be a thing, driven as I understood by SEO advice. Pretty sure the search engines don't care at all now! Once you do use, try not to flip back and forth, again I believe it has a penalty.

    One site I worked on had a 90k line .htaccess file! We migrated to nginx, fun day at the office. If you've got a few rules, a pattern, that's fine every request is passed through, hence the drag if you put too many in... So it's easier not to get started!

    Think about it though, when did you last type in a full url versus entering the title into a search box? Mobile users hardly see the urls anymore in either 'martial' design land or apples less is more view, so the actual url is just vanity.

    I would personally opt for style 4 or style 2 or even thread/1 which is thread 1 ;) style 4 is at risk of a rogue character or malformed altering the actual id. So 2 ;) If I'm on a site using paramaters and I see a per page=10, I'm quite often tempted to change that to 100... so the only other reason to cite friendly urls' is 'parameter' masking. But really this is a very small % argument.

    For the last, usercp area, no sense at all, unless you want it. IF you want convenience, get a stack of url shorteners for the key urls you can quickly send to people. like so.so/site-register > yourlongdomain?withlots=of%20parameters

    HTH.
     
    • Informative! Informative! x 1
    • List
  3. ChrisTERiS

    ChrisTERiS Developer

    552
    142
    +306
    ColinDColinD

    Thank you very much for your time to reply. Really appreciated. Seems that I forgot to mention something very important which can change the meaning of the question. I'm asking a Developer and not as Webmaster. I mean not for my own site.

    Till now I was coding using functions to prepare links on runtime depending on the user settings "Do you want to user SEO urls". And the style that I follow was "2", but I've seen some different formats, eg see xenForo here, and I think Wordpress is using also a "strange" link format.

    Again thank you
    Chris
     
  4. ColinD

    ColinD Enthusiast

    106
    93
    +51
    Chris,

    I sensed that might be the case, even easier then...

    Whatever makes your life easier to get it all shipped. Sorry. But I'd still play the easier and more efficient card, you can always enhance it later. If you're gunning for cross platform compatibility... eek.

    Most of the stuff I've done of late is 'restful' so style 2 wins. If I'm feeling funky, then I'll either use unique slug per resource or append as you have suggested the slug to the resource id. For the slug building stripping out all nefarious characters/case saves lots of headaches.
     
Verification:
Draft saved Draft deleted