Jump to content

cags

Staff Alumni
  • Posts

    3,217
  • Joined

  • Last visited

About cags

  • Birthday 07/03/1983

Contact Methods

  • Website URL
    http://www.tib-studios.co.uk

Profile Information

  • Gender
    Male
  • Location
    Leicestershire, UK

cags's Achievements

Member

Member (2/5)

1

Reputation

  1. premiso, will you be using a mirror to perform this talking to?
  2. Sure searching by id is probably quicker, but it's a matter of degrees. If you set the slug field to be an index, is that speed different actually going to be noticeable in a real-world environment?!
  3. Do you have access to edit the VirtualHost? It's certainly not going to be possible to do anything using .htaccess, but theoretically it may be possible to redirect from the vhost. Information in the request is encrypted so you won't have access to it until a certificate is loaded, but it must know what port the connection came in on, it may therefore be theoretically possible to redirect at that point.
  4. This can't be done purely via .htaccess, it's not magic, if the value isn't in the URL, then you can't use it in the script. You would need to update your script to fetch information from the database using 'article-title' instead of using the id (12). Basically you change the title to be the identifier of the article. Thus obviously it would need to be unique. Given the URL you describe it would seem you are already using mod_rewrite rules, these would just need a bit of tweaking to not match the id.
  5. Are you saying that on your server you have a directory in your root called city that has an FL folder with a Miami.html file inside of it and that you wish the url to appear as just /FL/Miami.html without the word city? RewriteEngine On RewriteRule ^(FL/Miami\.html)$ /city/$1 [L] I assume you have more than just the one URL you wish to rewrite, but since you didn't specify any parameters, I'm not going to bother hypothesising as I could be completely off. Either way it's just a matter of creating the correct regular expression to match the first half.
  6. OK, so we have a page on our site that works, it's a post with the id of 121 and is accessed via the URL http://mysite.com/viewItem.php?id=121, this is all fine and dandy but it's not as pretty as we would like to be, we want people to access it via http://mysite.com/121/border-collie-for-sale-to-good-home. Step 1: We need to use mod_rewrite in order to take a request for /121/border-collie-for-sale-to-good-home and serve up /viewItem.php?id=121. RewriteEngine On RewriteRule ^([0-9]+)/[a-z-]+/?$ /viewItem.php?id=$1 [L] We should now be able to type /121/border-collie-for-sale-to-good-home into our address bar, and view the page. Step 2: We need to update the links in our script so that they link to this newly beautified url. <a href="/<?php echo $postid;?>/<?php echo $thetitle;?>" Step 3: Celebrate. There are various nuances that can trip you up along the way, but this is essentially all the steps required.
  7. From memory it's under Windows/System32/drivers/etc/hosts.
  8. If a period is a required character, just add it into the first character set. Incidentally I see you are checking that the request doesn't end in a question mark. The query_string question mark is not part of the string tested against, not I believe a URL safe character.
  9. You don't. That's the point. You are attempting to parse data out of an HTML element, something that regular expressions are not really suited to. The solution shown by silkfire loads the html into a DOM object which are built specifically for handling html.
  10. Windows 7 most certainly isn't ignoring your config file. If anything then it's likely you have another web server such as IIS installed and it is this listening on port 80, not apache (or you are looking at the wrong config file). Look for other installations of Apache / IIS. Or search your hdd for index.htm, index.html, index.php , it should be one of them.
  11. First you need to set-up wildcard subdomains on your DNS. Assuming this is done, something like this should work... RewriteCond %{HTTP_HOST} !example.com RewriteRule .* http://example.com/%{REQUEST_URI} [R=302] Once you're happy it's working you can switch the 302 to 301.
  12. Try it without the character set, i.e. remove the square brackets from the regex, so it is just ^(.*)$
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.