Results 1 to 11 of 11

Thread: creating "wicked clean" urls

  1. #1
    User
    Join Date
    07-23-09.
    Location
    Massachusetts, United States
    Posts
    32

    Default creating "wicked clean" urls

    How can I create urls without any extension? I want neither html or php. I tried leaving the field empty in settings, but that definitely didn't work.

    I need to do this for creating landing pages in an ad campaign, so it's pretty important.

    thanks!
    Cheers,

    --- Link removed according to the forum rules ---
    Follow me on Twitter

  2. #2
    Core developer
    Official Contao Team
    leo's Avatar
    Join Date
    06-04-09.
    Location
    Wuppertal, Germany
    Posts
    201

    Default Re: creating "wicked clean" urls

    Quote Originally Posted by billhector
    I tried leaving the field empty in settings, but that definitely didn't work.
    It works for me though …

  3. #3
    User
    Join Date
    07-23-09.
    Location
    Massachusetts, United States
    Posts
    32

    Default Re: creating "wicked clean" urls

    nope. double checked my work. purged data (don't know if that would make a difference). I can't get this to work. Tried putting a slash in there too (to close the url) and still didn't get it to work.

    Here is my htacess file:

    Code:
    ##
    # Rewrite base
    ##
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    
    ##
    # Block malicious requests
    ##
    RewriteCond %{REQUEST_URI} (ftp|https?):|/etc/ [NC,OR]
    RewriteCond %{QUERY_STRING} (ftp|https?):|/etc/ [NC]
    RewriteRule .* - [F,L]
    
    ##
    # Compress .js and .css files
    ##
    AddEncoding gzip .gz
    <FilesMatch "\.js\.gz$">
      AddType "text/javascript" .gz
    </FilesMatch>
    <FilesMatch "\.css\.gz$">
      AddType "text/css" .gz
    </FilesMatch>
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME} \.(js|css)$
    RewriteCond %{REQUEST_FILENAME}.gz -f
    RewriteRule ^(.*)$ $1.gz [QSA,L]
    
    ##
    # Rewrite TYPOlight URLs
    ##
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .*\.html$ index.php [L]
    just standard stuff, no changes.

    any ideas? thanks for the help!
    Cheers,

    --- Link removed according to the forum rules ---
    Follow me on Twitter

  4. #4
    Core developer
    Official Contao Team
    leo's Avatar
    Join Date
    06-04-09.
    Location
    Wuppertal, Germany
    Posts
    201

    Default Re: creating "wicked clean" urls

    Quote Originally Posted by billhector
    just standard stuff, no changes.
    That is exactly the problem. The default routine only rewrites .html files.

  5. #5
    User
    Join Date
    07-23-09.
    Location
    Massachusetts, United States
    Posts
    32

    Default Re: creating "wicked clean" urls

    in case anybody is wondering how to do it, if you want to remove all extensions from your urls (and close the url with / ), first go to your settings and remove the default .html with /

    Then go to your htaccess file and find this line:

    Code:
    RewriteRule .*\.html$ index.php [L]
    and replace it with this:

    Code:
    RewriteRule . /index.php [L]
    That's it! you're good to go.

    Why would you want to do this? Well, in my case I am doing advertising and creating landing pages, thus extensions complicate the user experience. Of course, there are other reasons.
    Cheers,

    --- Link removed according to the forum rules ---
    Follow me on Twitter

  6. #6
    Core developer
    Official Contao Team
    leo's Avatar
    Join Date
    06-04-09.
    Location
    Wuppertal, Germany
    Posts
    201

    Default Re: creating "wicked clean" urls

    I think it should be

    Code:
    RewriteRule .* index.php [L]

  7. #7
    User
    Join Date
    06-29-09.
    Posts
    271

    Default Re: creating "wicked clean" urls

    Could you tell me about the other benefits and possible drawbacks? There is a lot to be found on SEO and of course what is best for users, it is hard though to figure out which method is actually best. But I'd switch .html for / if that really is better for a good reason.

    The only thing (seo) that I can think of is that directory names are more important then filenames for search engines.

    The only user experience advantage that I can think of is that no file extension means no typos (htm vs html)

  8. #8
    User
    Join Date
    07-23-09.
    Location
    Massachusetts, United States
    Posts
    32

    Default Re: creating "wicked clean" urls

    Quote Originally Posted by leo
    I think it should be

    Code:
    RewriteRule .* index.php [L]
    Humm ... either mine or yours seems to work with no error messages.
    Cheers,

    --- Link removed according to the forum rules ---
    Follow me on Twitter

  9. #9
    User
    Join Date
    07-23-09.
    Location
    Massachusetts, United States
    Posts
    32

    Default Re: creating "wicked clean" urls

    Quote Originally Posted by Vera
    The only user experience advantage that I can think of is that no file extension means no typos (htm vs html)
    Actually, for me SEO is not a reason to do this. That may or may not help. 95% of what you hear about SEO is crap. Did you know that last week the google announced they were no longer considering "page rank" in search result order?

    As I said previously, I need these shorter urls for creating landing pages and ad campaigns. So, for example, there is a holiday sale that I want to do an ad campaign for and we have a landing page just for that sale. For SEO purposes the page is called '/2009-holiday-sale-on-widgets.html'. that's way too much when dealing with buying ads through google, so I just create a new redirect page that redirects to the one with the longer url and name it /holiday-sale/

    Again, what I am dealing with is for specific situation. your mileage may vary.
    Cheers,

    --- Link removed according to the forum rules ---
    Follow me on Twitter

  10. #10
    Experienced user
    Join Date
    06-10-09.
    Location
    Atlanta, Georgia
    Posts
    611

    Default Re: creating "wicked clean" urls

    Thanks for the ".html removal" tips here, Bill and Leo.

    By the way, the only people I've ever met that say "wicked [something]" are from Connecticut and Massachusetts. Fred - I know you're guilty of this one too. :D

  11. #11
    User
    Join Date
    10-05-09.
    Location
    Dallas, TX, US
    Posts
    70

    Default Re: creating "wicked clean" urls

    This is very helpful, thanks everyone.

    Now if there were only an easier way to echo the page structure (like domain.com/people/mark/)... I haven't had any luck with the folderurl extension!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •