I'm new on this forum, I found it looking for some information about mod_rewrite.
I'm a webdesigner and I developed my own CMS to provide some extra service to my clients.
I'm working with some simple mod_rewrite code for SEO.
For example:
- Code: Select all
RewriteEngine On
RewriteBase /
RewriteRule ^beheer/$ beheer/index.php [L]
RewriteRule ^artikel/(.*)/$ artikel.php?id=$1 [L]
RewriteRule ^(.*)/$ index.php?webnaam=$1 [L]
RewriteRule ^beheer$ beheer/index.php [L]
As you can see, the links of my page's would look like this:
- Code: Select all
http://www.mywebpage.com/homepage/
But, a lot of time I'm testing things on my own domain on a subdirectory, or at my localhost at a subdirectory, so then te links look like:
- Code: Select all
http://localhost/subdirectory/homepage/
So verytime I put a website from my website/localhost to the real domain I have to change al the links/css reference's/javascript links/etc... and that's a lot of work and sometimes I forget one and than it don't work at the right way.
So my question is, could I make something link a substitute for de domain in a .htacces, so that I only have to change de url there and it automatic change everywhere else?
The idea is making my links something like:
- Code: Select all
{URL}/home/
{URL}/style.css
{URL}/javascript.js
And that .htacces change's that {URL} to the actual URL to the website. So that if I changes from domain / or directory I only have to change that regerence in the .htacces?
Is this possible?
Sorry for my poor English...
Thanks a lot for anyone who tries to help me!
Best regards
Gert van den Brink