Results 1 to 10 of 16

Hybrid View

  1. #1
    Join Date
    Feb 2009
    Posts
    895
    Plugin Contributions
    0

    Default Re: Shorter version of the URL

    OK I am not getting the result I want so I am obviously doing something wrong.

    My domain is creationcassel.com, and my store is on creationcassel.com/store

    I wrote:
    Redirect 301 /align https://creationcassel.com/store/ind...roducts_id=327

    Will that create a link for creationcassel.com/align or creationcassel.com/store/align ?

    And where to put the .htaccess file, would it be directly in the folder: creationcassel.com/store ? or somewhere else?

  2. #2
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: Shorter version of the URL

    How about clearly stating the wanted use of this rewrite concept so that hopefully a one time solution is provided.

    The placement of the file and the contents of it will be different based on what is desired/needed and the result sought.

    Also, when saying that not getting the result that you want, what result are you getting?

    Lastly, is that one liner the only thing in the .htaccess file? If so, that is part of the problem...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Feb 2009
    Posts
    895
    Plugin Contributions
    0

    Default Re: Shorter version of the URL

    You are correct. I was probably somewhat unclear.

    I am writing a book that will be printed (yes, on paper) so any link to a product in my store could not be clickable AND if i put the whole link it just looks "messy" and hard for someone to retype. So, I would like to have a shorter link that they could type with much less risk of typo.

    So, for example, instead of this link:
    https://creationcassel.com/store/ind...roducts_id=327

    I would like to be able to put something shorter, like:
    https://creationcassel.com/align
    and the viewer would be redirected to the full URL above.

    One suggetion was to include that code (that i mentioned above) in the .htaccess file, but since I don't have one, I have to create one.

    So there are the issue:
    - i probably created the .htaccess file wrong
    - i probably put it in the wrong place

    Right now, if I type https://creationcassel.com/align (or even https://creationcassel.com/store/align), i get a 404, so that is my hint that i am doing something(s) wrong.

  4. #4
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,303
    Plugin Contributions
    1

    Default Re: Shorter version of the URL

    Not an expert but I believe that you need to enable the RewriteEngine in the mod_rewrite module before adding the Redirect 301 line.

    I'm assuming you are using Apache web server and that the Apache module 'mod_rewrite' is already enabled. As an example, in my htaccess I have

    Code:
    Options +SymLinksIfOwnerMatch
    RewriteEngine on
    
    Redirect 301 .....
    I rarely use subdirectorys like '/store/ for my sites so I can't be sure as to the correct location for this htaccess, or whether it will rewrite as

    creationcassel.com/align or creationcassel.com/store/align
    I take more of a trial and error approach if I'm unsure.
    Simon

  5. #5
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: Shorter version of the URL

    And recommend that if taking a trial/error approach to first use a non-permanent designation such as a 302 until sure that it works as intended. Especially with various cache capability between the site and the customer. Once the rewrite works, then go ahead and make it a 301.

    I agree with simon1066's suggestion of at least enabling the RewriteEngine. The line above it may not be supported by the host, but is intended to provide a little bit of navigation protection.

    To address the requested rewrite, the .htaccess file would need to be at or above the directory to which the domain name is located. By above I mean that the file path would be "shorter". This way when the domain is asked to find /align, that it will start at the domain name. If it were placed in the store directory, then it wouldn't be found if first the domain name were sought/used.

    There may be some modifications necessary as can be identified by your host to ensure that the correct format is used for the environment in use.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,303
    Plugin Contributions
    1

    Default Re: Shorter version of the URL

    Quote Originally Posted by mc12345678 View Post
    And recommend that if taking a trial/error approach to first use a non-permanent designation such as a 302 until sure that it works as intended. Especially with various cache capability between the site and the customer. Once the rewrite works, then go ahead and make it a 301.
    I would recommend that a trial and error approach takes place on a test environment such as a local development server e.g. WAMPServer, XAAMP.
    Simon

  7. #7
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: Shorter version of the URL

    Quote Originally Posted by simon1066 View Post
    I would recommend that a trial and error approach takes place on a test environment such as a local development server e.g. WAMPServer, XAAMP.
    The recommendation of using a 302 instead of a 301 still applies regardless of the environment. For example if a short cut were put into the browser to use /align and then a 301 is issued, it is expected that the shortcut would get updated to the new location... and actually may want to consider always using a 302 or similar non-permanent redirect for that very reason. Ie. Published link is /align, it may point to location x for now, but later to location y. If a 301 is issued and that link updated say at a browser, then almost need to redirect the old location to the new location as well... not at all desirable to work that way. But with a 302 (or similar non-permanent redirect), the link is expected to remain as originally provided and will always be available for wherever it is modified to end up at.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. v154 How to make the search box shorter on the right sidebox?
    By lina0962 in forum General Questions
    Replies: 5
    Last Post: 26 Nov 2015, 05:22 PM
  2. Shorter SEO-friendly URLs
    By driven13 in forum General Questions
    Replies: 7
    Last Post: 31 Jul 2010, 08:22 AM
  3. Shorter Category Descriptions?
    By chris parker in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 6 Jan 2008, 05:05 PM
  4. Changing address bar URL's to shorter versions
    By peacefuldaze in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 20 Dec 2007, 02:23 PM

Posting Permissions

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