Can I make visitdevonandcornwall.com/DevonAccommodation.php look like visitdevonandcornwall.com/Devon/Accommodation loosing the .php as well, using re writes, if so how? Any ideas would be great
That is not working an ideas please Nintendo has written a great crib here but has anyone know of areal numpties advice site?
Not all, but a whole bunch. also I want to do this visitdevonandcornwall.com/guesthouse1.php in to visitdevonandcornwall.com/devon-cornwall/guest-house I assume mod rewrites are my easiest option. Jamie That is my current .htacess file, if that helps
I just checked your /Devon/Accomodation URL and it comes back with a 300 (multiple choices) response. Make sure you end your re-write line with [L] for this rule. For example: RewriteRule ^Devon/Accommodation/?$ DevonAccommodation.php [L] If you want some generic mechanism, you can use something like this: RewriteRule ^([A-Z][a-z]+)/([A-Z][a-z]+)/?$ $1$2.php [L] This will rewrite things like /My/Folder to /MyFolder.php. Just keep in mind that this will work on *all* capitalized URLs. You might want to prefix it with something like /acm/... to distinguish from other URLs. J.D.
RewriteRule ^Devon/Accommodation/?$ DevonAccommodation.php [L] That is not working for some reason !!! EDIT This seems to work - RewriteRule ^Devon/Accommodation/?$ /DevonAccommodation.php [L]
Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^([^.]+)$ $1.php [L] Would be the easiest way, having them all go from from WhatEver.php to WhatEver/ I'm not sure if you can add a / in to it if the script doesn't have that, unless you use a line for every script. Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^Devon/Accommodation$ DevonAccommodation.php [L] RewriteRule ^devon-cornwall/guest-house$ guesthouse1.php [L]
Thank you Nintendo!! As I have deep links to my pages, where the URL will now change, should I be putting a 301 redirect in place??
If old URLs are indexed in search engines, then yes. Both original and new links will work, but the redirect gets rid of duplicate content. Only change to the code is [L] being changed to [R=301,L] and using the full URL RewriteRule ^whatever.php$ http://www.domain.com/whatever [R=301,L] I'm not sure if that'll both make the new URL work and also redirect to it.
RewriteRule ^AccommodationCornwall.php$ http://www.test.visitdevonandcornwall.co.uk/cornwall/accommodation [R=301,L] is giving me 300 multiple choices page ?
Does it have Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / with it? I'm not sure what causes that error. That's the first time I've seen that!
That would happen if RewriteBase is missing. Adding slash in front works just as fine. There's no need for this, really. This rule will rewrite all capitalized URLs: RewriteRule ^([A-Z][a-z]+)/([A-Z][a-z]+)/?$ /$1$2.php [R,L] That is, /Devon/Accomodation will be rewritten as /DevonAccomdation.php. J.D.
RewriteRule ^cornwall/accommodation?$ /AccommodationCornwall.php [L] Which is out putting this, which is perfect http://www.test.visitdevonandcornwall.co.uk/cornwall/accommodation But I cant seem to 301 it JB9P
Only way I know of for doing 301 is changing a URL to another URL that's not the original URL. Not redirecting the original URL to the new mod_rewrite URLs. Original URLs always work with the new URLs when you use mod_rewrite. You just don't want links pointing to both types of URLs!
OK, when I do these re writes why is this happening link properties are staying the same, ie http://www.test.visitdevonandcornwall.co.uk/ad_antiques.php but image properties http://www.test.visitdevonandcornwall.co.uk/devon/adverts/K&J.jpg Correct URL http://www.test.visitdevonandcornwall.co.uk/adverts/K&J.jpg What do I do about this???
For images, using the full URL, or if there's not a / right after the first " try adding the / after it.
I must be doing something wrong as that is not helping. Anyone have any ideas on how to get around this!!